[FFmpeg-devel] [PATCH 1/2] adtsenc: check packet size
Michael Niedermayer
michaelni at gmx.at
Mon Nov 28 05:30:07 CET 2011
No, i dont have a sample file, i just noticed that this isnt
checked when looking at the code.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavformat/adtsenc.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 4b14b95..9053b3e 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -128,6 +128,10 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
if (!pkt->size)
return 0;
if (adts->write_adts) {
+ if(ADTS_HEADER_SIZE + pkt->size + adts->pce_size >= (1U<<13)){
+ av_log(s, AV_LOG_ERROR, "Packet size %d too big\n", pkt->size);
+ return -1;
+ }
ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size);
avio_write(pb, buf, ADTS_HEADER_SIZE);
if (adts->pce_size) {
--
1.7.5.4
More information about the ffmpeg-devel
mailing list