diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-11 22:50:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-11 22:50:49 +0100 |
commit | 817ed4fae9d0221af12f60309db8b8263e60c9c8 (patch) | |
tree | a3afb66ac9b874e7f436640077efe4f0edf37531 | |
parent | 22377751c9676849ea554b9220870df9dd344f7d (diff) | |
parent | 82776caf7993221719eefbe576f851c7e52dfef9 (diff) | |
download | ffmpeg-817ed4fae9d0221af12f60309db8b8263e60c9c8.tar.gz |
Merge commit '82776caf7993221719eefbe576f851c7e52dfef9' into release/0.10
* commit '82776caf7993221719eefbe576f851c7e52dfef9':
rmenc: limit packet size
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/rmenc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index b3d0cf6a66..59d35fccf2 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) @@ -387,6 +391,10 @@ 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 + if (size > MAX_PACKET_SIZE) { + av_log_missing_feature(s, "Muxing packets larger than 64 kB", 0); + return AVERROR(ENOSYS); + } write_packet_header(s, stream, size + 7 + (size >= 0x4000)*4, key_frame); /* bit 7: '1' if final packet of a frame converted in several packets */ avio_w8(pb, 0x81); |