aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-06-27 17:50:56 +0200
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-26 01:38:17 +0100
commit5999a89190e4f3530e10efb9a92c6a87eae21fa2 (patch)
tree055d9ae378819b407b22132170958affe1a84d97
parent7bd9ae4afb248ba7b8a5cc772f5931c15808ae0f (diff)
downloadffmpeg-5999a89190e4f3530e10efb9a92c6a87eae21fa2.tar.gz
nutdec: check maxpos in read_sm_data before returning success
Otherwise sm_size can be larger than size, which results in a negative packet size. Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 6b9fdf7f4f07926557048070cc2af3cfd0e3fe50) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r--libavformat/nutdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 8d2b145d8d..76fd8cc554 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -963,6 +963,9 @@ static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
AV_WL32(dst+4, skip_end);
}
+ if (avio_tell(bc) >= maxpos)
+ return AVERROR_INVALIDDATA;
+
return 0;
}