[FFmpeg-cvslog] flv: Validate the packet size
Luca Barbato
git at videolan.org
Sat Oct 28 21:29:52 EEST 2017
ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Apr 17 14:10:52 2017 +0000| [279e3aaa14daba6b7a37d75f3fb6e29c732d123f] | committer: Luca Barbato
flv: Validate the packet size
Size can be negative at that point.
Bug-Id: 1041
CC: libav-stable at libav.org
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=279e3aaa14daba6b7a37d75f3fb6e29c732d123f
---
libavformat/flvdec.c | 6 ++++++
1 file changed, 6 insertions(+)
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;
More information about the ffmpeg-cvslog
mailing list