aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mxfenc.c
diff options
context:
space:
mode:
authorTomas Härdin <tomas.hardin@codemill.se>2012-10-24 17:06:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-24 17:46:27 +0200
commite3ba817b95bbdc7c8aaf83b4a6804d1b49eb4de4 (patch)
treea52327034a8f1876f31c7c4c6dfde04d22e8cd4a /libavformat/mxfenc.c
parentfbb39f44f1d37451be7d575b5923e6d5851aaecc (diff)
downloadffmpeg-e3ba817b95bbdc7c8aaf83b4a6804d1b49eb4de4.tar.gz
mxfenc: Fix possible integer overflows
None of these are likely unless the user is writing a file with two billion streams or a duration of around two months. This fixes CIDs 700568, 700569, 700570, 700571, 700572 and 700573. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mxfenc.c')
-rw-r--r--libavformat/mxfenc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index a2dbd8b018..7acc77940c 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -550,7 +550,7 @@ static void mxf_write_preface(AVFormatContext *s)
mxf_write_metadata_key(pb, 0x012f00);
PRINT_KEY(s, "preface key", pb->buf_ptr - 16);
- klv_encode_ber_length(pb, 130 + 16 * mxf->essence_container_count);
+ klv_encode_ber_length(pb, 130 + 16LL * mxf->essence_container_count);
// write preface set uid
mxf_write_local_tag(pb, 16, 0x3C0A);
@@ -823,7 +823,7 @@ static void mxf_write_multi_descriptor(AVFormatContext *s)
mxf_write_metadata_key(pb, 0x014400);
PRINT_KEY(s, "multiple descriptor key", pb->buf_ptr - 16);
- klv_encode_ber_length(pb, 64 + 16 * s->nb_streams);
+ klv_encode_ber_length(pb, 64 + 16LL * s->nb_streams);
mxf_write_local_tag(pb, 16, 0x3C0A);
mxf_write_uuid(pb, MultipleDescriptor, 0);
@@ -1165,8 +1165,8 @@ static void mxf_write_index_table_segment(AVFormatContext *s)
if (mxf->edit_unit_byte_count) {
klv_encode_ber_length(pb, 80);
} else {
- klv_encode_ber_length(pb, 85 + 12+(s->nb_streams+1)*6 +
- 12+mxf->edit_units_count*(11+mxf->slice_count*4));
+ klv_encode_ber_length(pb, 85 + 12+(s->nb_streams+1LL)*6 +
+ 12+mxf->edit_units_count*(11+mxf->slice_count*4LL));
}
// instance id
@@ -1326,7 +1326,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
// write klv
avio_write(pb, key, 16);
- klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count);
+ klv_encode_ber_length(pb, 88 + 16LL * mxf->essence_container_count);
// write partition value
avio_wb16(pb, 1); // majorVersion
@@ -2004,7 +2004,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s)
int i;
avio_write(pb, random_index_pack_key, 16);
- klv_encode_ber_length(pb, 28 + 12*mxf->body_partitions_count);
+ klv_encode_ber_length(pb, 28 + 12LL*mxf->body_partitions_count);
if (mxf->edit_unit_byte_count)
avio_wb32(pb, 1); // BodySID of header partition