Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6aa6a9c2
Commit
6aa6a9c2
authored
Jul 03, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: validate the sample rate when scanning the tag
Don't calculate the song duration when the sample rate is 0 (division by zero crash).
parent
8d1c7ca2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
NEWS
NEWS
+1
-0
flac_metadata.c
src/decoder/flac_metadata.c
+2
-1
flac_metadata.h
src/decoder/flac_metadata.h
+3
-0
No files found.
NEWS
View file @
6aa6a9c2
ver 0.16.4 (2010/??/??)
ver 0.16.4 (2010/??/??)
* decoder:
* decoder:
- ffmpeg: workaround for semantic API change in recent ffmpeg versions
- ffmpeg: workaround for semantic API change in recent ffmpeg versions
- flac: validate the sample rate when scanning the tag
ver 0.16.3 (2011/06/04)
ver 0.16.3 (2011/06/04)
...
...
src/decoder/flac_metadata.c
View file @
6aa6a9c2
...
@@ -224,7 +224,8 @@ flac_tag_apply_metadata(struct tag *tag, const char *track,
...
@@ -224,7 +224,8 @@ flac_tag_apply_metadata(struct tag *tag, const char *track,
break
;
break
;
case
FLAC__METADATA_TYPE_STREAMINFO
:
case
FLAC__METADATA_TYPE_STREAMINFO
:
tag
->
time
=
flac_duration
(
&
block
->
data
.
stream_info
);
if
(
block
->
data
.
stream_info
.
sample_rate
>
0
)
tag
->
time
=
flac_duration
(
&
block
->
data
.
stream_info
);
break
;
break
;
default:
default:
...
...
src/decoder/flac_metadata.h
View file @
6aa6a9c2
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#ifndef MPD_FLAC_METADATA_H
#ifndef MPD_FLAC_METADATA_H
#define MPD_FLAC_METADATA_H
#define MPD_FLAC_METADATA_H
#include <assert.h>
#include <stdbool.h>
#include <stdbool.h>
#include <FLAC/metadata.h>
#include <FLAC/metadata.h>
...
@@ -29,6 +30,8 @@ struct replay_gain_info;
...
@@ -29,6 +30,8 @@ struct replay_gain_info;
static
inline
unsigned
static
inline
unsigned
flac_duration
(
const
FLAC__StreamMetadata_StreamInfo
*
stream_info
)
flac_duration
(
const
FLAC__StreamMetadata_StreamInfo
*
stream_info
)
{
{
assert
(
stream_info
->
sample_rate
>
0
);
return
(
stream_info
->
total_samples
+
stream_info
->
sample_rate
-
1
)
/
return
(
stream_info
->
total_samples
+
stream_info
->
sample_rate
-
1
)
/
stream_info
->
sample_rate
;
stream_info
->
sample_rate
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment