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
4373a25d
Commit
4373a25d
authored
Dec 15, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/mxfdec: Fix memleaks reading corrupt files.
Fixes ticket #4173. Reviewed-by: Tomas Härdin
parent
27bdfd29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
mxfdec.c
libavformat/mxfdec.c
+14
-6
No files found.
libavformat/mxfdec.c
View file @
4373a25d
...
@@ -863,8 +863,11 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
...
@@ -863,8 +863,11 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
if
(
!
(
segment
->
temporal_offset_entries
=
av_calloc
(
segment
->
nb_index_entries
,
sizeof
(
*
segment
->
temporal_offset_entries
)))
||
if
(
!
(
segment
->
temporal_offset_entries
=
av_calloc
(
segment
->
nb_index_entries
,
sizeof
(
*
segment
->
temporal_offset_entries
)))
||
!
(
segment
->
flag_entries
=
av_calloc
(
segment
->
nb_index_entries
,
sizeof
(
*
segment
->
flag_entries
)))
||
!
(
segment
->
flag_entries
=
av_calloc
(
segment
->
nb_index_entries
,
sizeof
(
*
segment
->
flag_entries
)))
||
!
(
segment
->
stream_offset_entries
=
av_calloc
(
segment
->
nb_index_entries
,
sizeof
(
*
segment
->
stream_offset_entries
))))
!
(
segment
->
stream_offset_entries
=
av_calloc
(
segment
->
nb_index_entries
,
sizeof
(
*
segment
->
stream_offset_entries
))))
{
av_freep
(
&
segment
->
temporal_offset_entries
);
av_freep
(
&
segment
->
flag_entries
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
for
(
i
=
0
;
i
<
segment
->
nb_index_entries
;
i
++
)
{
for
(
i
=
0
;
i
<
segment
->
nb_index_entries
;
i
++
)
{
segment
->
temporal_offset_entries
[
i
]
=
avio_r8
(
pb
);
segment
->
temporal_offset_entries
[
i
]
=
avio_r8
(
pb
);
...
@@ -2168,16 +2171,20 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
...
@@ -2168,16 +2171,20 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
}
}
}
}
}
}
if
(
ctx_size
&&
tag
==
0x3C0A
)
if
(
ctx_size
&&
tag
==
0x3C0A
)
{
avio_read
(
pb
,
ctx
->
uid
,
16
);
avio_read
(
pb
,
ctx
->
uid
,
16
);
else
if
((
ret
=
read_child
(
ctx
,
pb
,
tag
,
size
,
uid
,
-
1
))
<
0
)
}
else
if
((
ret
=
read_child
(
ctx
,
pb
,
tag
,
size
,
uid
,
-
1
))
<
0
)
{
mxf_free_metadataset
(
&
ctx
);
return
ret
;
return
ret
;
}
/* Accept the 64k local set limit being exceeded (Avid). Don't accept
/* Accept the 64k local set limit being exceeded (Avid). Don't accept
* it extending past the end of the KLV though (zzuf5.mxf). */
* it extending past the end of the KLV though (zzuf5.mxf). */
if
(
avio_tell
(
pb
)
>
klv_end
)
{
if
(
avio_tell
(
pb
)
>
klv_end
)
{
if
(
ctx_size
)
if
(
ctx_size
)
{
av_free
(
ctx
);
ctx
->
type
=
type
;
mxf_free_metadataset
(
&
ctx
);
}
av_log
(
mxf
->
fc
,
AV_LOG_ERROR
,
av_log
(
mxf
->
fc
,
AV_LOG_ERROR
,
"local tag %#04x extends past end of local set @ %#"
PRIx64
"
\n
"
,
"local tag %#04x extends past end of local set @ %#"
PRIx64
"
\n
"
,
...
@@ -2565,7 +2572,8 @@ static int mxf_read_header(AVFormatContext *s)
...
@@ -2565,7 +2572,8 @@ static int mxf_read_header(AVFormatContext *s)
/* FIXME avoid seek */
/* FIXME avoid seek */
if
(
!
essence_offset
)
{
if
(
!
essence_offset
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"no essence
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"no essence
\n
"
);
return
AVERROR_INVALIDDATA
;
ret
=
AVERROR_INVALIDDATA
;
goto
fail
;
}
}
avio_seek
(
s
->
pb
,
essence_offset
,
SEEK_SET
);
avio_seek
(
s
->
pb
,
essence_offset
,
SEEK_SET
);
...
...
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