diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-09 01:35:28 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-09 01:36:01 +0100 |
commit | 20655dd2ec1b3567396a8190d313e740f83a87d6 (patch) | |
tree | 52a00c84f8c9a274c03e72487c9caf341022cdbb | |
parent | 73ca672fb6e6661a5e1b5d1ec3ad06bfbe144fd4 (diff) | |
parent | 2ef2f60b4f0308d1c871091c9c1a9641d14ec585 (diff) | |
download | ffmpeg-20655dd2ec1b3567396a8190d313e740f83a87d6.tar.gz |
Merge commit '2ef2f60b4f0308d1c871091c9c1a9641d14ec585' into release/2.4
* commit '2ef2f60b4f0308d1c871091c9c1a9641d14ec585':
rmenc: limit packet size
Conflicts:
libavformat/rmenc.c
See: 73ca672fb6e6661a5e1b5d1ec3ad06bfbe144fd4
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 27b5d8264d..a22b01b4a0 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -44,6 +44,10 @@ typedef struct { /* 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) @@ -394,9 +398,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); |