Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f1bdc234
Commit
f1bdc234
authored
Jul 11, 2015
by
Andreas Cadhalpun
Committed by
Luca Barbato
Jul 11, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riff: Validate bitrate
parent
c1d647b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
riffdec.c
libavformat/riffdec.c
+19
-1
No files found.
libavformat/riffdec.c
View file @
f1bdc234
...
...
@@ -79,6 +79,7 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
AVCodecContext
*
codec
,
int
size
)
{
int
id
;
uint64_t
bitrate
;
if
(
size
<
14
)
return
AVERROR_INVALIDDATA
;
...
...
@@ -87,7 +88,7 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
codec
->
channels
=
avio_rl16
(
pb
);
codec
->
sample_rate
=
avio_rl32
(
pb
);
codec
->
bit_rate
=
avio_rl32
(
pb
)
*
8
;
bitrate
=
avio_rl32
(
pb
)
*
8
;
codec
->
block_align
=
avio_rl16
(
pb
);
if
(
size
==
14
)
{
/* We're dealing with plain vanilla WAVEFORMAT */
codec
->
bits_per_coded_sample
=
8
;
...
...
@@ -124,6 +125,23 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
if
(
size
>
0
)
avio_skip
(
pb
,
size
);
}
if
(
bitrate
>
INT_MAX
)
{
if
(
s
->
error_recognition
&
AV_EF_EXPLODE
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"The bitrate %"
PRIu64
" is too large.
\n
"
,
bitrate
);
return
AVERROR_INVALIDDATA
;
}
else
{
av_log
(
s
,
AV_LOG_WARNING
,
"The bitrate %"
PRIu64
" is too large, resetting to 0."
,
bitrate
);
codec
->
bit_rate
=
0
;
}
}
else
{
codec
->
bit_rate
=
bitrate
;
}
if
(
codec
->
sample_rate
<=
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid sample rate: %d
\n
"
,
codec
->
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