Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
bc426827
Commit
bc426827
authored
Aug 03, 2012
by
Clément Bœsch
Committed by
Clément Bœsch
Aug 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/movenc: fix invalid free with timecode meta and tmcd data copy.
Fixes ticket 1577.
parent
31d8261c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
movenc.c
libavformat/movenc.c
+19
-4
movenc.h
libavformat/movenc.h
+1
-0
No files found.
libavformat/movenc.c
View file @
bc426827
...
...
@@ -3334,14 +3334,29 @@ static int mov_write_header(AVFormatContext *s)
}
if
(
mov
->
mode
==
MODE_MOV
)
{
/* Add a tmcd track for each video stream with a timecode */
tmcd_track
=
mov
->
nb_streams
;
/* +1 tmcd track for each video stream with a timecode */
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVStream
*
st
=
s
->
streams
[
i
];
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
(
global_tcr
||
av_dict_get
(
st
->
metadata
,
"timecode"
,
NULL
,
0
)))
mov
->
nb_streams
++
;
mov
->
nb_meta_tmcd
++
;
}
/* check if there is already a tmcd track to remux */
if
(
mov
->
nb_meta_tmcd
)
{
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVStream
*
st
=
s
->
streams
[
i
];
if
(
st
->
codec
->
codec_tag
==
MKTAG
(
't'
,
'm'
,
'c'
,
'd'
))
{
av_log
(
s
,
AV_LOG_WARNING
,
"You requested a copy of the original timecode track "
"so timecode metadata are now ignored
\n
"
);
mov
->
nb_meta_tmcd
=
0
;
}
}
}
mov
->
nb_streams
+=
mov
->
nb_meta_tmcd
;
}
mov
->
tracks
=
av_mallocz
(
mov
->
nb_streams
*
sizeof
(
*
mov
->
tracks
));
...
...
@@ -3468,7 +3483,7 @@ static int mov_write_header(AVFormatContext *s)
}
}
if
(
mov
->
mode
==
MODE_MOV
)
{
if
(
mov
->
nb_meta_tmcd
)
{
/* Initialize the tmcd tracks */
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVStream
*
st
=
s
->
streams
[
i
];
...
...
@@ -3551,7 +3566,7 @@ static int mov_write_trailer(AVFormatContext *s)
for
(
i
=
0
;
i
<
mov
->
nb_streams
;
i
++
)
{
if
(
mov
->
tracks
[
i
].
tag
==
MKTAG
(
'r'
,
't'
,
'p'
,
' '
))
ff_mov_close_hinting
(
&
mov
->
tracks
[
i
]);
else
if
(
mov
->
tracks
[
i
].
tag
==
MKTAG
(
't'
,
'm'
,
'c'
,
'd'
))
else
if
(
mov
->
tracks
[
i
].
tag
==
MKTAG
(
't'
,
'm'
,
'c'
,
'd'
)
&&
mov
->
nb_meta_tmcd
)
av_freep
(
&
mov
->
tracks
[
i
].
enc
);
if
(
mov
->
flags
&
FF_MOV_FLAG_FRAGMENT
&&
mov
->
tracks
[
i
].
vc1_info
.
struct_offset
&&
s
->
pb
->
seekable
)
{
...
...
libavformat/movenc.h
View file @
bc426827
...
...
@@ -142,6 +142,7 @@ typedef struct MOVMuxContext {
int
mode
;
int64_t
time
;
int
nb_streams
;
int
nb_meta_tmcd
;
///< number of new created tmcd track based on metadata (aka not data copy)
int
chapter_track
;
///< qt chapter track number
int64_t
mdat_pos
;
uint64_t
mdat_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