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
58d13cea
Commit
58d13cea
authored
Oct 22, 2013
by
Derek Buitenhuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: Check all allocations
Signed-off-by:
Derek Buitenhuis
<
derek.buitenhuis@gmail.com
>
parent
9510d768
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
h264.c
libavcodec/h264.c
+18
-7
No files found.
libavcodec/h264.c
View file @
58d13cea
...
@@ -1605,19 +1605,24 @@ static void copy_picture_range(Picture **to, Picture **from, int count,
...
@@ -1605,19 +1605,24 @@ static void copy_picture_range(Picture **to, Picture **from, int count,
}
}
}
}
static
void
copy_parameter_set
(
void
**
to
,
void
**
from
,
int
count
,
int
size
)
static
int
copy_parameter_set
(
void
**
to
,
void
**
from
,
int
count
,
int
size
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
to
[
i
]
&&
!
from
[
i
])
if
(
to
[
i
]
&&
!
from
[
i
])
{
av_freep
(
&
to
[
i
]);
av_freep
(
&
to
[
i
]);
else
if
(
from
[
i
]
&&
!
to
[
i
])
}
else
if
(
from
[
i
]
&&
!
to
[
i
])
{
to
[
i
]
=
av_malloc
(
size
);
to
[
i
]
=
av_malloc
(
size
);
if
(
!
to
[
i
])
return
AVERROR
(
ENOMEM
);
}
if
(
from
[
i
])
if
(
from
[
i
])
memcpy
(
to
[
i
],
from
[
i
],
size
);
memcpy
(
to
[
i
],
from
[
i
],
size
);
}
}
return
0
;
}
}
static
int
decode_init_thread_copy
(
AVCodecContext
*
avctx
)
static
int
decode_init_thread_copy
(
AVCodecContext
*
avctx
)
...
@@ -1781,11 +1786,15 @@ static int decode_update_thread_context(AVCodecContext *dst,
...
@@ -1781,11 +1786,15 @@ static int decode_update_thread_context(AVCodecContext *dst,
h
->
is_avc
=
h1
->
is_avc
;
h
->
is_avc
=
h1
->
is_avc
;
// SPS/PPS
// SPS/PPS
copy_parameter_set
((
void
**
)
h
->
sps_buffers
,
(
void
**
)
h1
->
sps_buffers
,
if
((
ret
=
copy_parameter_set
((
void
**
)
h
->
sps_buffers
,
MAX_SPS_COUNT
,
sizeof
(
SPS
));
(
void
**
)
h1
->
sps_buffers
,
MAX_SPS_COUNT
,
sizeof
(
SPS
)))
<
0
)
return
ret
;
h
->
sps
=
h1
->
sps
;
h
->
sps
=
h1
->
sps
;
copy_parameter_set
((
void
**
)
h
->
pps_buffers
,
(
void
**
)
h1
->
pps_buffers
,
if
((
ret
=
copy_parameter_set
((
void
**
)
h
->
pps_buffers
,
MAX_PPS_COUNT
,
sizeof
(
PPS
));
(
void
**
)
h1
->
pps_buffers
,
MAX_PPS_COUNT
,
sizeof
(
PPS
)))
<
0
)
return
ret
;
h
->
pps
=
h1
->
pps
;
h
->
pps
=
h1
->
pps
;
// Dequantization matrices
// Dequantization matrices
...
@@ -3154,6 +3163,8 @@ static int h264_slice_header_init(H264Context *h, int reinit)
...
@@ -3154,6 +3163,8 @@ static int h264_slice_header_init(H264Context *h, int reinit)
for
(
i
=
1
;
i
<
h
->
slice_context_count
;
i
++
)
{
for
(
i
=
1
;
i
<
h
->
slice_context_count
;
i
++
)
{
H264Context
*
c
;
H264Context
*
c
;
c
=
h
->
thread_context
[
i
]
=
av_mallocz
(
sizeof
(
H264Context
));
c
=
h
->
thread_context
[
i
]
=
av_mallocz
(
sizeof
(
H264Context
));
if
(
!
c
)
return
AVERROR
(
ENOMEM
);
c
->
avctx
=
h
->
avctx
;
c
->
avctx
=
h
->
avctx
;
c
->
dsp
=
h
->
dsp
;
c
->
dsp
=
h
->
dsp
;
c
->
vdsp
=
h
->
vdsp
;
c
->
vdsp
=
h
->
vdsp
;
...
...
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