From patchwork Tue Aug 22 01:56:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4795 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.137.29 with SMTP id o29csp365708jaj; Mon, 21 Aug 2017 18:56:59 -0700 (PDT) X-Received: by 10.223.183.38 with SMTP id l38mr9278240wre.103.1503367019825; Mon, 21 Aug 2017 18:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503367019; cv=none; d=google.com; s=arc-20160816; b=IcMKzypjht94hhA6X22AvaRkXwwZArNw346gWlTTUOqX05rWpQEhDC3gsiGS9pN9F3 5imVNio3XIeWzHj4FDJJlH6HrGBDRSvM+Zhc/BLceCB+DPV0ZbV+aNoUjlQCD36FDYR4 TBKkpa+MyW9bc/sZlHqdBZJnk4LUGkI/SZJhWLPHg0qlrz9XUt7W8hyFl76RWN3/ldQL xO4dtcyzgj6Pg/XwLmBubp2gaDj4kn+D1pyujtG43aMpml/UtEKphg0thpjE5dBSvZLr +7SZpoFQYL8jIQP3+gXX+Q2OLT50k/3yOoDZ5z2ujSFXq+GvM6b10tyML11I7bqNpIjI EmKQ== 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=4e8a55+1qusQiN8rXQRRbTnQnpKfvLHPTPO3WuornIc=; b=OtcCq+GBRJHM6yutdez3sVpR1x9dO5y7ElFunKeD3HriBglZSIpXgXLnjPso0uSdZV dQd/krrnPxBrdDAIB/lBuXr08SeG6kRnpNco3QiBvgaSKfqqTCaZsM7K425CBDux6bap 3Q826GNxkiZRtIBKclRh1Li2cwuMBRrf0roNfUY83XCTRUU4ucZvHFZUBjfZYmKDraTr YX7oCoPGqV6IfDlnUbCjiwznWknEU3YC3SwzwKNqSTNtS6B1yotoetnnkJgN5qCEc8Yo t20Me4W4J/daKT62mpbDBqJUCyBceOh/xam5aC/k060nS8SEdYp6IES8Os7gvOnafDDs Vzpg== 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 q9si10239348wrc.19.2017.08.21.18.56.58; Mon, 21 Aug 2017 18:56:59 -0700 (PDT) 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 3DC33689B5C; Tue, 22 Aug 2017 04:56:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-2.mx.upcmail.net (vie01a-dmta-pe02-2.mx.upcmail.net [62.179.121.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E027680D33 for ; Tue, 22 Aug 2017 04:56:42 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1djyQy-0001mZ-LB for ffmpeg-devel@ffmpeg.org; Tue, 22 Aug 2017 03:56:48 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 01wi1w00j0S5wYM011wjVs; Tue, 22 Aug 2017 03:56:43 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 22 Aug 2017 03:56:41 +0200 Message-Id: <20170822015641.28225-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [PATCH] avcodec/dvbsubdec: Check for duplicate regions in dvbsub_parse_page_segment() 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: OOM Fixes: 3051/clusterfuzz-testcase-minimized-5745818336231424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dvbsubdec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 98619f9631..b683109643 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1302,6 +1302,15 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx, region_id = *buf++; buf += 1; + display = ctx->display_list; + while (display && display->region_id != region_id) { + display = display->next; + } + if (display) { + av_log(avctx, AV_LOG_ERROR, "duplicate region\n"); + break; + } + display = tmp_display_list; tmp_ptr = &tmp_display_list;