summaryrefslogtreecommitdiff
path: root/libavformat/flvdec.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2017-04-17 14:10:52 +0000
committerLuca Barbato <lu_zero@gentoo.org>2017-04-20 15:39:18 +0000
commit279e3aaa14daba6b7a37d75f3fb6e29c732d123f (patch)
tree1da2923a6874502fce11a1df3ac5be483e80f661 /libavformat/flvdec.c
parent4809781586d1c956005f72946a2aab5915eab350 (diff)
flv: Validate the packet size
Size can be negative at that point. Bug-Id: 1041 CC: libav-stable@libav.org
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r--libavformat/flvdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 693c859ebf..1b29740f41 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -912,6 +912,12 @@ skip:
st->codecpar->codec_id == AV_CODEC_ID_H264) {
int type = avio_r8(s->pb);
size--;
+
+ if (size < 0) {
+ ret = AVERROR_INVALIDDATA;
+ goto leave;
+ }
+
if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
// sign extension
int32_t cts = (avio_rb24(s->pb) + 0xff800000) ^ 0xff800000;