diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-05 20:24:27 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-05 20:24:58 +0100 |
commit | be07270bcaae0dc2a32f9b11d4a73d6f6a8564e3 (patch) | |
tree | 74b4ec68da0067513ed17c2ce89fdcd3a764c325 | |
parent | 6af5bf604c97e9f4c686d9ca480d12613dc64277 (diff) | |
parent | bb4edddd9389cc1601db618ed3c1375b62628d04 (diff) | |
download | ffmpeg-be07270bcaae0dc2a32f9b11d4a73d6f6a8564e3.tar.gz |
Merge commit 'bb4edddd9389cc1601db618ed3c1375b62628d04'
* commit 'bb4edddd9389cc1601db618ed3c1375b62628d04':
rmenc: limit packet size
Conflicts:
libavformat/rmenc.c
See: 08728f400b8367dc8c983036cb2eff3a2891322b
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/rmenc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 8763fff235..cd32f271f1 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -44,6 +44,10 @@ typedef struct RMMuxContext { /* in ms */ #define BUFFER_DURATION 0 +/* the header needs at most 7 + 4 + 12 B */ +#define MAX_HEADER_SIZE (7 + 4 + 12) +/* UINT16_MAX is the maximal chunk size */ +#define MAX_PACKET_SIZE (UINT16_MAX - MAX_HEADER_SIZE) static void put_str(AVIOContext *s, const char *tag) @@ -396,9 +400,8 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int /* Well, I spent some time finding the meaning of these bits. I am not sure I understood everything, but it works !! */ #if 1 - /* 0xFFFF is the maximal chunk size; header needs at most 7 + 4 + 12 B */ - if (size > 0xFFFF - 7 - 4 - 12) { - av_log(s, AV_LOG_ERROR, "large packet size %d not supported\n", size); + if (size > MAX_PACKET_SIZE) { + av_log(s, AV_LOG_ERROR, "Muxing packets larger than 64 kB (%d) is not supported\n", size); return AVERROR_PATCHWELCOME; } write_packet_header(s, stream, size + 7 + (size >= 0x4000)*4, key_frame); |