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
665759c3
Commit
665759c3
authored
Jun 14, 2019
by
Steven Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/dashdec: check copy_init_section memory alloc result
Signed-off-by:
Steven Liu
<
lq@chinaffmpeg.org
>
parent
6f82bf9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
dashdec.c
libavformat/dashdec.c
+16
-4
No files found.
libavformat/dashdec.c
View file @
665759c3
...
@@ -2008,13 +2008,19 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls)
...
@@ -2008,13 +2008,19 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls)
return
1
;
return
1
;
}
}
static
void
copy_init_section
(
struct
representation
*
rep_dest
,
struct
representation
*
rep_src
)
static
int
copy_init_section
(
struct
representation
*
rep_dest
,
struct
representation
*
rep_src
)
{
{
rep_dest
->
init_sec_buf
=
av_mallocz
(
rep_src
->
init_sec_buf_size
);
rep_dest
->
init_sec_buf
=
av_mallocz
(
rep_src
->
init_sec_buf_size
);
if
(
!
rep_dest
->
init_sec_buf
)
{
av_log
(
rep_dest
->
ctx
,
AV_LOG_WARNING
,
"Cannot alloc memory for init_sec_buf
\n
"
);
return
AVERROR
(
ENOMEM
);
}
memcpy
(
rep_dest
->
init_sec_buf
,
rep_src
->
init_sec_buf
,
rep_src
->
init_sec_data_len
);
memcpy
(
rep_dest
->
init_sec_buf
,
rep_src
->
init_sec_buf
,
rep_src
->
init_sec_data_len
);
rep_dest
->
init_sec_buf_size
=
rep_src
->
init_sec_buf_size
;
rep_dest
->
init_sec_buf_size
=
rep_src
->
init_sec_buf_size
;
rep_dest
->
init_sec_data_len
=
rep_src
->
init_sec_data_len
;
rep_dest
->
init_sec_data_len
=
rep_src
->
init_sec_data_len
;
rep_dest
->
cur_timestamp
=
rep_src
->
cur_timestamp
;
rep_dest
->
cur_timestamp
=
rep_src
->
cur_timestamp
;
return
0
;
}
}
...
@@ -2048,7 +2054,9 @@ static int dash_read_header(AVFormatContext *s)
...
@@ -2048,7 +2054,9 @@ static int dash_read_header(AVFormatContext *s)
for
(
i
=
0
;
i
<
c
->
n_videos
;
i
++
)
{
for
(
i
=
0
;
i
<
c
->
n_videos
;
i
++
)
{
struct
representation
*
cur_video
=
c
->
videos
[
i
];
struct
representation
*
cur_video
=
c
->
videos
[
i
];
if
(
i
>
0
&&
c
->
is_init_section_common_video
)
{
if
(
i
>
0
&&
c
->
is_init_section_common_video
)
{
copy_init_section
(
cur_video
,
c
->
videos
[
0
]);
ret
=
copy_init_section
(
cur_video
,
c
->
videos
[
0
]);
if
(
ret
<
0
)
goto
fail
;
}
}
ret
=
open_demux_for_component
(
s
,
cur_video
);
ret
=
open_demux_for_component
(
s
,
cur_video
);
...
@@ -2064,7 +2072,9 @@ static int dash_read_header(AVFormatContext *s)
...
@@ -2064,7 +2072,9 @@ static int dash_read_header(AVFormatContext *s)
for
(
i
=
0
;
i
<
c
->
n_audios
;
i
++
)
{
for
(
i
=
0
;
i
<
c
->
n_audios
;
i
++
)
{
struct
representation
*
cur_audio
=
c
->
audios
[
i
];
struct
representation
*
cur_audio
=
c
->
audios
[
i
];
if
(
i
>
0
&&
c
->
is_init_section_common_audio
)
{
if
(
i
>
0
&&
c
->
is_init_section_common_audio
)
{
copy_init_section
(
cur_audio
,
c
->
audios
[
0
]);
ret
=
copy_init_section
(
cur_audio
,
c
->
audios
[
0
]);
if
(
ret
<
0
)
goto
fail
;
}
}
ret
=
open_demux_for_component
(
s
,
cur_audio
);
ret
=
open_demux_for_component
(
s
,
cur_audio
);
...
@@ -2080,7 +2090,9 @@ static int dash_read_header(AVFormatContext *s)
...
@@ -2080,7 +2090,9 @@ static int dash_read_header(AVFormatContext *s)
for
(
i
=
0
;
i
<
c
->
n_subtitles
;
i
++
)
{
for
(
i
=
0
;
i
<
c
->
n_subtitles
;
i
++
)
{
struct
representation
*
cur_subtitle
=
c
->
subtitles
[
i
];
struct
representation
*
cur_subtitle
=
c
->
subtitles
[
i
];
if
(
i
>
0
&&
c
->
is_init_section_common_audio
)
{
if
(
i
>
0
&&
c
->
is_init_section_common_audio
)
{
copy_init_section
(
cur_subtitle
,
c
->
subtitles
[
0
]);
ret
=
copy_init_section
(
cur_subtitle
,
c
->
subtitles
[
0
]);
if
(
ret
<
0
)
goto
fail
;
}
}
ret
=
open_demux_for_component
(
s
,
cur_subtitle
);
ret
=
open_demux_for_component
(
s
,
cur_subtitle
);
...
...
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