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
73dacabf
Commit
73dacabf
authored
Apr 09, 2015
by
Vittorio Giovara
Committed by
Diego Biurrun
Apr 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffv1: Check memory allocations
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
4e544321
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
ffv1.c
libavcodec/ffv1.c
+16
-4
No files found.
libavcodec/ffv1.c
View file @
73dacabf
...
...
@@ -187,7 +187,7 @@ int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
av_cold
int
ffv1_init_slice_contexts
(
FFV1Context
*
f
)
{
int
i
;
int
i
,
j
;
f
->
slice_count
=
f
->
num_h_slices
*
f
->
num_v_slices
;
if
(
f
->
slice_count
<=
0
)
{
...
...
@@ -196,13 +196,16 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
}
for
(
i
=
0
;
i
<
f
->
slice_count
;
i
++
)
{
FFV1Context
*
fs
=
av_mallocz
(
sizeof
(
*
fs
));
int
sx
=
i
%
f
->
num_h_slices
;
int
sy
=
i
/
f
->
num_h_slices
;
int
sxs
=
f
->
avctx
->
width
*
sx
/
f
->
num_h_slices
;
int
sxe
=
f
->
avctx
->
width
*
(
sx
+
1
)
/
f
->
num_h_slices
;
int
sys
=
f
->
avctx
->
height
*
sy
/
f
->
num_v_slices
;
int
sye
=
f
->
avctx
->
height
*
(
sy
+
1
)
/
f
->
num_v_slices
;
FFV1Context
*
fs
=
av_mallocz
(
sizeof
(
*
fs
));
if
(
!
fs
)
goto
memfail
;
f
->
slice_context
[
i
]
=
fs
;
memcpy
(
fs
,
f
,
sizeof
(
*
fs
));
memset
(
fs
->
rc_stat2
,
0
,
sizeof
(
fs
->
rc_stat2
));
...
...
@@ -214,10 +217,19 @@ av_cold int ffv1_init_slice_contexts(FFV1Context *f)
fs
->
sample_buffer
=
av_malloc
(
3
*
MAX_PLANES
*
(
fs
->
width
+
6
)
*
sizeof
(
*
fs
->
sample_buffer
));
if
(
!
fs
->
sample_buffer
)
return
AVERROR
(
ENOMEM
);
if
(
!
fs
->
sample_buffer
)
{
av_free
(
fs
);
goto
memfail
;
}
}
return
0
;
memfail:
for
(
j
=
0
;
j
<
i
;
j
++
)
{
av_free
(
&
f
->
slice_context
[
j
]
->
sample_buffer
);
av_free
(
&
f
->
slice_context
[
j
]);
}
return
AVERROR
(
ENOMEM
);
}
int
ffv1_allocate_initial_states
(
FFV1Context
*
f
)
...
...
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