aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-03-02 15:46:44 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-06-10 02:13:09 +0200
commit3d11279745a64e7eb65f63b76dbc9d561651fcfc (patch)
treef6fc9d9bd1686b366248dff8153d506bd0276a3b
parent63efad67ee56565c6376e8233a83d8b1837fef3a (diff)
downloadffmpeg-3d11279745a64e7eb65f63b76dbc9d561651fcfc.tar.gz
avformat/rm: limit packet size
The chunk size is limited to 0xFFFF (written by avio_wb16), so make sure that the packet size is not too large. Such large frames need to be split into slices smaller than 64 kB, but that is currently supported neither by the rv10/rv20 encoders nor the rm muxer. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> See Ticket244 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 08728f400b8367dc8c983036cb2eff3a2891322b) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rmenc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index 17192ff275..a4e97a02e9 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -391,6 +391,11 @@ 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);
+ return AVERROR_PATCHWELCOME;
+ }
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);