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
8a9641a6
Commit
8a9641a6
authored
Dec 18, 2014
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bsf: check memory allocations
parent
014b6b41
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
3 deletions
+24
-3
bitstream_filter.c
libavcodec/bitstream_filter.c
+10
-2
dump_extradata_bsf.c
libavcodec/dump_extradata_bsf.c
+2
-0
imx_dump_header_bsf.c
libavcodec/imx_dump_header_bsf.c
+2
-0
mjpega_dump_header_bsf.c
libavcodec/mjpega_dump_header_bsf.c
+2
-0
movsub_bsf.c
libavcodec/movsub_bsf.c
+4
-0
noise_bsf.c
libavcodec/noise_bsf.c
+2
-1
parser.c
libavcodec/parser.c
+2
-0
No files found.
libavcodec/bitstream_filter.c
View file @
8a9641a6
...
...
@@ -47,9 +47,17 @@ AVBitStreamFilterContext *av_bitstream_filter_init(const char *name)
if
(
!
strcmp
(
name
,
bsf
->
name
))
{
AVBitStreamFilterContext
*
bsfc
=
av_mallocz
(
sizeof
(
AVBitStreamFilterContext
));
if
(
!
bsfc
)
return
NULL
;
bsfc
->
filter
=
bsf
;
bsfc
->
priv_data
=
bsf
->
priv_data_size
?
av_mallocz
(
bsf
->
priv_data_size
)
:
NULL
;
bsfc
->
priv_data
=
NULL
;
if
(
bsf
->
priv_data_size
)
{
bsfc
->
priv_data
=
av_mallocz
(
bsf
->
priv_data_size
);
if
(
!
bsfc
->
priv_data
)
{
av_freep
(
&
bsfc
);
return
NULL
;
}
}
return
bsfc
;
}
bsf
=
bsf
->
next
;
...
...
libavcodec/dump_extradata_bsf.c
View file @
8a9641a6
...
...
@@ -37,6 +37,8 @@ static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx,
int
size
=
buf_size
+
avctx
->
extradata_size
;
*
poutbuf_size
=
size
;
*
poutbuf
=
av_malloc
(
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!*
poutbuf
)
return
AVERROR
(
ENOMEM
);
memcpy
(
*
poutbuf
,
avctx
->
extradata
,
avctx
->
extradata_size
);
memcpy
((
*
poutbuf
)
+
avctx
->
extradata_size
,
buf
,
buf_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
...
...
libavcodec/imx_dump_header_bsf.c
View file @
8a9641a6
...
...
@@ -43,6 +43,8 @@ static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx
}
*
poutbuf
=
av_malloc
(
buf_size
+
20
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!*
poutbuf
)
return
AVERROR
(
ENOMEM
);
poutbufp
=
*
poutbuf
;
bytestream_put_buffer
(
&
poutbufp
,
imx_header
,
16
);
bytestream_put_byte
(
&
poutbufp
,
0x83
);
/* KLV BER long form */
...
...
libavcodec/mjpega_dump_header_bsf.c
View file @
8a9641a6
...
...
@@ -45,6 +45,8 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av
*
poutbuf_size
=
0
;
*
poutbuf
=
av_malloc
(
buf_size
+
44
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!*
poutbuf
)
return
AVERROR
(
ENOMEM
);
poutbufp
=
*
poutbuf
;
bytestream_put_byte
(
&
poutbufp
,
0xff
);
bytestream_put_byte
(
&
poutbufp
,
SOI
);
...
...
libavcodec/movsub_bsf.c
View file @
8a9641a6
...
...
@@ -29,6 +29,8 @@ static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co
if
(
buf_size
>
0xffff
)
return
0
;
*
poutbuf_size
=
buf_size
+
2
;
*
poutbuf
=
av_malloc
(
*
poutbuf_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!*
poutbuf
)
return
AVERROR
(
ENOMEM
);
AV_WB16
(
*
poutbuf
,
buf_size
);
memcpy
(
*
poutbuf
+
2
,
buf
,
buf_size
);
return
1
;
...
...
@@ -46,6 +48,8 @@ static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, co
if
(
buf_size
<
2
)
return
0
;
*
poutbuf_size
=
FFMIN
(
buf_size
-
2
,
AV_RB16
(
buf
));
*
poutbuf
=
av_malloc
(
*
poutbuf_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!*
poutbuf
)
return
AVERROR
(
ENOMEM
);
memcpy
(
*
poutbuf
,
buf
+
2
,
*
poutbuf_size
);
return
1
;
}
...
...
libavcodec/noise_bsf.c
View file @
8a9641a6
...
...
@@ -33,7 +33,8 @@ static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const ch
int
i
;
*
poutbuf
=
av_malloc
(
buf_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!*
poutbuf
)
return
AVERROR
(
ENOMEM
);
memcpy
(
*
poutbuf
,
buf
,
buf_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
for
(
i
=
0
;
i
<
buf_size
;
i
++
){
(
*
state
)
+=
(
*
poutbuf
)[
i
]
+
1
;
...
...
libavcodec/parser.c
View file @
8a9641a6
...
...
@@ -193,6 +193,8 @@ int av_parser_change(AVCodecParserContext *s, AVCodecContext *avctx,
*
poutbuf_size
=
size
;
*
poutbuf
=
av_malloc
(
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!*
poutbuf
)
return
AVERROR
(
ENOMEM
);
memcpy
(
*
poutbuf
,
avctx
->
extradata
,
avctx
->
extradata_size
);
memcpy
(
*
poutbuf
+
avctx
->
extradata_size
,
buf
,
...
...
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