Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
e8d41dd3
Commit
e8d41dd3
authored
Jun 28, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check malloc return value.
parent
c8e9ec96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+27
-10
No files found.
modules/codec/avcodec/video.c
View file @
e8d41dd3
...
...
@@ -371,6 +371,11 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys
->
i_buffer
=
0
;
p_sys
->
i_buffer_orig
=
1
;
p_sys
->
p_buffer_orig
=
p_sys
->
p_buffer
=
malloc
(
p_sys
->
i_buffer_orig
);
if
(
!
p_sys
->
p_buffer_orig
)
{
free
(
p_sys
);
return
VLC_ENOMEM
;
}
/* Set output properties */
p_dec
->
fmt_out
.
i_cat
=
VIDEO_ES
;
...
...
@@ -528,6 +533,11 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
}
p_sys
->
p_buffer
=
p_sys
->
p_buffer_orig
;
p_sys
->
i_buffer
=
p_block
->
i_buffer
;
if
(
!
p_sys
->
p_buffer
)
{
block_Release
(
p_block
);
return
NULL
;
}
vlc_memcpy
(
p_sys
->
p_buffer
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
memset
(
p_sys
->
p_buffer
+
p_block
->
i_buffer
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
...
...
@@ -725,6 +735,8 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
p_sys
->
p_context
->
extradata_size
=
i_size
+
12
;
p
=
p_sys
->
p_context
->
extradata
=
malloc
(
p_sys
->
p_context
->
extradata_size
);
if
(
!
p
)
return
;
memcpy
(
&
p
[
0
],
"SVQ3"
,
4
);
memset
(
&
p
[
4
],
0
,
8
);
...
...
@@ -763,13 +775,15 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
{
p_sys
->
p_context
->
extradata_size
=
8
;
p_sys
->
p_context
->
extradata
=
malloc
(
8
);
if
(
p_sys
->
p_context
->
extradata
)
{
memcpy
(
p_sys
->
p_context
->
extradata
,
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_in
.
i_extra
);
p_sys
->
p_context
->
sub_id
=
((
uint32_t
*
)
p_dec
->
fmt_in
.
p_extra
)[
1
];
memcpy
(
p_sys
->
p_context
->
extradata
,
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_in
.
i_extra
);
p_sys
->
p_context
->
sub_id
=
((
uint32_t
*
)
p_dec
->
fmt_in
.
p_extra
)[
1
];
msg_Warn
(
p_dec
,
"using extra data for RV codec sub_id=%08x"
,
p_sys
->
p_context
->
sub_id
);
msg_Warn
(
p_dec
,
"using extra data for RV codec sub_id=%08x"
,
p_sys
->
p_context
->
sub_id
);
}
}
}
else
...
...
@@ -777,10 +791,13 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
p_sys
->
p_context
->
extradata_size
=
i_size
;
p_sys
->
p_context
->
extradata
=
malloc
(
i_size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
memcpy
(
p_sys
->
p_context
->
extradata
,
p_dec
->
fmt_in
.
p_extra
,
i_size
);
memset
(
&
((
uint8_t
*
)
p_sys
->
p_context
->
extradata
)[
i_size
],
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
p_sys
->
p_context
->
extradata
)
{
memcpy
(
p_sys
->
p_context
->
extradata
,
p_dec
->
fmt_in
.
p_extra
,
i_size
);
memset
(
&
((
uint8_t
*
)
p_sys
->
p_context
->
extradata
)[
i_size
],
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