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
57810910
Commit
57810910
authored
Jan 19, 2008
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check malloc return
Originally committed as revision 11562 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
8513ba09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
mxf.c
libavformat/mxf.c
+18
-0
No files found.
libavformat/mxf.c
View file @
57810910
...
@@ -281,6 +281,8 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
...
@@ -281,6 +281,8 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
if
(
!
mxf
->
aesc
&&
s
->
key
&&
s
->
keylen
==
16
)
{
if
(
!
mxf
->
aesc
&&
s
->
key
&&
s
->
keylen
==
16
)
{
mxf
->
aesc
=
av_malloc
(
av_aes_size
);
mxf
->
aesc
=
av_malloc
(
av_aes_size
);
if
(
!
mxf
->
aesc
)
return
-
1
;
av_aes_init
(
mxf
->
aesc
,
s
->
key
,
128
,
1
);
av_aes_init
(
mxf
->
aesc
,
s
->
key
,
128
,
1
);
}
}
// crypto context
// crypto context
...
@@ -368,6 +370,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -368,6 +370,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
static
int
mxf_add_metadata_set
(
MXFContext
*
mxf
,
void
*
metadata_set
)
static
int
mxf_add_metadata_set
(
MXFContext
*
mxf
,
void
*
metadata_set
)
{
{
mxf
->
metadata_sets
=
av_realloc
(
mxf
->
metadata_sets
,
(
mxf
->
metadata_sets_count
+
1
)
*
sizeof
(
*
mxf
->
metadata_sets
));
mxf
->
metadata_sets
=
av_realloc
(
mxf
->
metadata_sets
,
(
mxf
->
metadata_sets_count
+
1
)
*
sizeof
(
*
mxf
->
metadata_sets
));
if
(
!
mxf
->
metadata_sets
)
return
-
1
;
mxf
->
metadata_sets
[
mxf
->
metadata_sets_count
]
=
metadata_set
;
mxf
->
metadata_sets
[
mxf
->
metadata_sets_count
]
=
metadata_set
;
mxf
->
metadata_sets_count
++
;
mxf
->
metadata_sets_count
++
;
return
0
;
return
0
;
...
@@ -394,6 +398,8 @@ static int mxf_read_metadata_content_storage(MXFContext *mxf, ByteIOContext *pb,
...
@@ -394,6 +398,8 @@ static int mxf_read_metadata_content_storage(MXFContext *mxf, ByteIOContext *pb,
if
(
mxf
->
packages_count
>=
UINT_MAX
/
sizeof
(
UID
))
if
(
mxf
->
packages_count
>=
UINT_MAX
/
sizeof
(
UID
))
return
-
1
;
return
-
1
;
mxf
->
packages_refs
=
av_malloc
(
mxf
->
packages_count
*
sizeof
(
UID
));
mxf
->
packages_refs
=
av_malloc
(
mxf
->
packages_count
*
sizeof
(
UID
));
if
(
!
mxf
->
packages_refs
)
return
-
1
;
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
get_buffer
(
pb
,
(
uint8_t
*
)
mxf
->
packages_refs
,
mxf
->
packages_count
*
sizeof
(
UID
));
get_buffer
(
pb
,
(
uint8_t
*
)
mxf
->
packages_refs
,
mxf
->
packages_count
*
sizeof
(
UID
));
break
;
break
;
...
@@ -430,6 +436,8 @@ static int mxf_read_metadata_material_package(MXFPackage *package, ByteIOContext
...
@@ -430,6 +436,8 @@ static int mxf_read_metadata_material_package(MXFPackage *package, ByteIOContext
if
(
package
->
tracks_count
>=
UINT_MAX
/
sizeof
(
UID
))
if
(
package
->
tracks_count
>=
UINT_MAX
/
sizeof
(
UID
))
return
-
1
;
return
-
1
;
package
->
tracks_refs
=
av_malloc
(
package
->
tracks_count
*
sizeof
(
UID
));
package
->
tracks_refs
=
av_malloc
(
package
->
tracks_count
*
sizeof
(
UID
));
if
(
!
package
->
tracks_refs
)
return
-
1
;
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
get_buffer
(
pb
,
(
uint8_t
*
)
package
->
tracks_refs
,
package
->
tracks_count
*
sizeof
(
UID
));
get_buffer
(
pb
,
(
uint8_t
*
)
package
->
tracks_refs
,
package
->
tracks_count
*
sizeof
(
UID
));
break
;
break
;
...
@@ -471,6 +479,8 @@ static int mxf_read_metadata_sequence(MXFSequence *sequence, ByteIOContext *pb,
...
@@ -471,6 +479,8 @@ static int mxf_read_metadata_sequence(MXFSequence *sequence, ByteIOContext *pb,
if
(
sequence
->
structural_components_count
>=
UINT_MAX
/
sizeof
(
UID
))
if
(
sequence
->
structural_components_count
>=
UINT_MAX
/
sizeof
(
UID
))
return
-
1
;
return
-
1
;
sequence
->
structural_components_refs
=
av_malloc
(
sequence
->
structural_components_count
*
sizeof
(
UID
));
sequence
->
structural_components_refs
=
av_malloc
(
sequence
->
structural_components_count
*
sizeof
(
UID
));
if
(
!
sequence
->
structural_components_refs
)
return
-
1
;
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
get_buffer
(
pb
,
(
uint8_t
*
)
sequence
->
structural_components_refs
,
sequence
->
structural_components_count
*
sizeof
(
UID
));
get_buffer
(
pb
,
(
uint8_t
*
)
sequence
->
structural_components_refs
,
sequence
->
structural_components_count
*
sizeof
(
UID
));
break
;
break
;
...
@@ -486,6 +496,8 @@ static int mxf_read_metadata_source_package(MXFPackage *package, ByteIOContext *
...
@@ -486,6 +496,8 @@ static int mxf_read_metadata_source_package(MXFPackage *package, ByteIOContext *
if
(
package
->
tracks_count
>=
UINT_MAX
/
sizeof
(
UID
))
if
(
package
->
tracks_count
>=
UINT_MAX
/
sizeof
(
UID
))
return
-
1
;
return
-
1
;
package
->
tracks_refs
=
av_malloc
(
package
->
tracks_count
*
sizeof
(
UID
));
package
->
tracks_refs
=
av_malloc
(
package
->
tracks_count
*
sizeof
(
UID
));
if
(
!
package
->
tracks_refs
)
return
-
1
;
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
get_buffer
(
pb
,
(
uint8_t
*
)
package
->
tracks_refs
,
package
->
tracks_count
*
sizeof
(
UID
));
get_buffer
(
pb
,
(
uint8_t
*
)
package
->
tracks_refs
,
package
->
tracks_count
*
sizeof
(
UID
));
break
;
break
;
...
@@ -532,6 +544,8 @@ static int mxf_read_metadata_generic_descriptor(MXFDescriptor *descriptor, ByteI
...
@@ -532,6 +544,8 @@ static int mxf_read_metadata_generic_descriptor(MXFDescriptor *descriptor, ByteI
if
(
descriptor
->
sub_descriptors_count
>=
UINT_MAX
/
sizeof
(
UID
))
if
(
descriptor
->
sub_descriptors_count
>=
UINT_MAX
/
sizeof
(
UID
))
return
-
1
;
return
-
1
;
descriptor
->
sub_descriptors_refs
=
av_malloc
(
descriptor
->
sub_descriptors_count
*
sizeof
(
UID
));
descriptor
->
sub_descriptors_refs
=
av_malloc
(
descriptor
->
sub_descriptors_count
*
sizeof
(
UID
));
if
(
!
descriptor
->
sub_descriptors_refs
)
return
-
1
;
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
url_fskip
(
pb
,
4
);
/* useless size of objects, always 16 according to specs */
get_buffer
(
pb
,
(
uint8_t
*
)
descriptor
->
sub_descriptors_refs
,
descriptor
->
sub_descriptors_count
*
sizeof
(
UID
));
get_buffer
(
pb
,
(
uint8_t
*
)
descriptor
->
sub_descriptors_refs
,
descriptor
->
sub_descriptors_count
*
sizeof
(
UID
));
break
;
break
;
...
@@ -572,6 +586,8 @@ static int mxf_read_metadata_generic_descriptor(MXFDescriptor *descriptor, ByteI
...
@@ -572,6 +586,8 @@ static int mxf_read_metadata_generic_descriptor(MXFDescriptor *descriptor, ByteI
break
;
break
;
case
0x8201
:
/* Private tag used by SONY C0023S01.mxf */
case
0x8201
:
/* Private tag used by SONY C0023S01.mxf */
descriptor
->
extradata
=
av_malloc
(
size
);
descriptor
->
extradata
=
av_malloc
(
size
);
if
(
!
descriptor
->
extradata
)
return
-
1
;
descriptor
->
extradata_size
=
size
;
descriptor
->
extradata_size
=
size
;
get_buffer
(
pb
,
descriptor
->
extradata
,
size
);
get_buffer
(
pb
,
descriptor
->
extradata
,
size
);
break
;
break
;
...
@@ -884,6 +900,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, int (*read_child
...
@@ -884,6 +900,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, int (*read_child
MXFMetadataSet
*
ctx
=
ctx_size
?
av_mallocz
(
ctx_size
)
:
mxf
;
MXFMetadataSet
*
ctx
=
ctx_size
?
av_mallocz
(
ctx_size
)
:
mxf
;
uint64_t
klv_end
=
url_ftell
(
pb
)
+
klv
->
length
;
uint64_t
klv_end
=
url_ftell
(
pb
)
+
klv
->
length
;
if
(
!
ctx
)
return
-
1
;
while
(
url_ftell
(
pb
)
+
4
<
klv_end
)
{
while
(
url_ftell
(
pb
)
+
4
<
klv_end
)
{
int
tag
=
get_be16
(
pb
);
int
tag
=
get_be16
(
pb
);
int
size
=
get_be16
(
pb
);
/* KLV specified by 0x53 */
int
size
=
get_be16
(
pb
);
/* KLV specified by 0x53 */
...
...
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