Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 6b67d7f05918f7a1ee8fc6ff21355d7e8736aa10 Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael Niedermayer <michael@niedermayer.cc> |
| 3 | Date: Sat, 28 Jul 2018 15:03:50 +0200 |
| 4 | Subject: [PATCH] avformat/flvenc: Check audio packet size |
| 5 | |
| 6 | Fixes: Assertion failure |
| 7 | Fixes: assert_flvenc.c:941_1.swf |
| 8 | |
| 9 | Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/6b67d7f05918f7a1ee8fc6ff21355d7e8736aa10] |
| 10 | CVE: CVE-2018-15822 |
| 11 | |
| 12 | Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg> |
| 13 | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> |
| 14 | Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> |
| 15 | --- |
| 16 | libavformat/flvenc.c | 5 +++++ |
| 17 | 1 file changed, 5 insertions(+) |
| 18 | |
| 19 | diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c |
| 20 | index 1c552a3e6b..e4863f1fc7 100644 |
| 21 | --- a/libavformat/flvenc.c |
| 22 | +++ b/libavformat/flvenc.c |
| 23 | @@ -883,6 +883,11 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) |
| 24 | int flags = -1, flags_size, ret; |
| 25 | int64_t cur_offset = avio_tell(pb); |
| 26 | |
| 27 | + if (par->codec_type == AVMEDIA_TYPE_AUDIO && !pkt->size) { |
| 28 | + av_log(s, AV_LOG_WARNING, "Empty audio Packet\n"); |
| 29 | + return AVERROR(EINVAL); |
| 30 | + } |
| 31 | + |
| 32 | if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == AV_CODEC_ID_VP6A || |
| 33 | par->codec_id == AV_CODEC_ID_VP6 || par->codec_id == AV_CODEC_ID_AAC) |
| 34 | flags_size = 2; |
| 35 | -- |
| 36 | 2.17.1 |
| 37 | |