From patchwork Mon Feb 26 22:00:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7750 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp1851303jaj; Mon, 26 Feb 2018 14:00:42 -0800 (PST) X-Google-Smtp-Source: AG47ELufKGoQJSMelOMM5ZiCbIV8pS23KoIQkd5inZxRbWkVtYiRZBtPi+DoZGXN7LrPVQjgAhwc X-Received: by 10.28.66.65 with SMTP id p62mr4068947wma.8.1519682441927; Mon, 26 Feb 2018 14:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519682441; cv=none; d=google.com; s=arc-20160816; b=SrH9zbjUtCYf+iGvQ0lshu9kVwxiWNfCkQTTG2KxILjQcuDYgBqdSx8PgYldn3Wtbv h9s99ZVS40Mx7kJU9QIeGmLDtBozTi3X56D2veVCE+cSCraM7u7JXhV6toyTAvX60Bj3 g5pkvH5G35ONvUooLXttOYdefVOMLr6x9YeINKQAT3kf2bPXar4c7VtNC+26M+gD4hys nv2hRr9ijxgRyM9fG2pOMseKqXebbKgiOuYWKNzD+sVRv5/JBlB2yZQHeWm9Izrd6MeG knY+9fRzxePsTHVIXiW3xTSpwjZQmdoqegjAXZEbjgQA8E8TuOD6/7bZoJxgE/pkJ75q v8XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=97uAXujVmnBEkW8E0VphynguG7ijBwW4zD+HrfbeBdY=; b=p6r9ttZqjiIwiUsTgHRco9CusYWUzSvNzTWiuvK7W8b+PiuLwtc6KlYy47KeadAfs+ u/QMfJ8EphcxXkhpu71ScwFQeD309hdC8Ai3l2dcpb67NDhCZBV6MoTY6CrfPF/MO+oy UUEO4GOwB/fLQbj+K1qSvv0wh/rSATuB+6yjCoObjLzcs+7JGWfjL4fLBVMIxIe5CudX 87s7O1rdnAkxzmCQu7kcsNO3SllUzrPYOTFPhJ1n/oovz0V7cj+jnQ0LPm2Wm0lVOnX2 pwlqIiGJCfYOdU7n9suX8kWTEeXHpqNe/JRYTzYfoZtWnclhQDXaTXyy4lMNfGJ4dlJu iGnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n125si3999577wmn.222.2018.02.26.14.00.41; Mon, 26 Feb 2018 14:00:41 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 74E9968A19E; Tue, 27 Feb 2018 00:00:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-1.mx.upcmail.net (vie01a-dmta-pe03-1.mx.upcmail.net [62.179.121.160]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 38CC1689FD3 for ; Tue, 27 Feb 2018 00:00:29 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eqQoy-0000n5-S9 for ffmpeg-devel@ffmpeg.org; Mon, 26 Feb 2018 23:00:32 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id Fa0W1x0130S5wYM01a0XrF; Mon, 26 Feb 2018 23:00:31 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 26 Feb 2018 23:00:28 +0100 Message-Id: <20180226220029.21010-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.2 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/msmpeg4dec: Check for input end in msmpeg4v34_decode_mb() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: Timeout Fixes: 6276/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV1_fuzzer-5881196690014208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/msmpeg4dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 4105d4ba7d..457a37e745 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -208,6 +208,9 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64]) uint8_t *coded_val; uint32_t * const mb_type_ptr = &s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride]; + if (get_bits_left(&s->gb) <= 0) + return AVERROR_INVALIDDATA; + if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->use_skip_mb_code) { if (get_bits1(&s->gb)) {