Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
4df30f71
Commit
4df30f71
authored
Jan 12, 2012
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: Check for extradata size overflows.
parent
81dc6a2a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
internal.h
libavcodec/internal.h
+7
-0
utils.c
libavcodec/utils.c
+3
-0
utils.c
libavformat/utils.c
+3
-1
No files found.
libavcodec/internal.h
View file @
4df30f71
...
...
@@ -94,4 +94,11 @@ unsigned int avpriv_toupper4(unsigned int x);
int
avpriv_lock_avformat
(
void
);
int
avpriv_unlock_avformat
(
void
);
/**
* Maximum size in bytes of extradata.
* This value was chosen such that every bit of the buffer is
* addressable by a 32-bit signed integer as used by get_bits.
*/
#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
#endif
/* AVCODEC_INTERNAL_H */
libavcodec/utils.c
View file @
4df30f71
...
...
@@ -610,6 +610,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
int
ret
=
0
;
AVDictionary
*
tmp
=
NULL
;
if
(
avctx
->
extradata_size
<
0
||
avctx
->
extradata_size
>=
FF_MAX_EXTRADATA_SIZE
)
return
AVERROR
(
EINVAL
);
if
(
options
)
av_dict_copy
(
&
tmp
,
*
options
,
0
);
...
...
libavformat/utils.c
View file @
4df30f71
...
...
@@ -2442,9 +2442,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
if
(
st
->
parser
&&
st
->
parser
->
parser
->
split
&&
!
st
->
codec
->
extradata
){
int
i
=
st
->
parser
->
parser
->
split
(
st
->
codec
,
pkt
->
data
,
pkt
->
size
);
if
(
i
)
{
if
(
i
>
0
&&
i
<
FF_MAX_EXTRADATA_SIZE
)
{
st
->
codec
->
extradata_size
=
i
;
st
->
codec
->
extradata
=
av_malloc
(
st
->
codec
->
extradata_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
st
->
codec
->
extradata
)
return
AVERROR
(
ENOMEM
);
memcpy
(
st
->
codec
->
extradata
,
pkt
->
data
,
st
->
codec
->
extradata_size
);
memset
(
st
->
codec
->
extradata
+
i
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
...
...
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