From patchwork Mon Feb 26 22:00:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7751 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp1851501jaj; Mon, 26 Feb 2018 14:00:50 -0800 (PST) X-Google-Smtp-Source: AG47ELtbPadasg2Ot2hL+htpt+J2s8m1fzaUSLm9XkNDpJ2270klyiFLK880vnDaZkpJIQvlZ4tV X-Received: by 10.28.50.69 with SMTP id y66mr6718296wmy.35.1519682450199; Mon, 26 Feb 2018 14:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519682450; cv=none; d=google.com; s=arc-20160816; b=CI8kvcKvRKlFIofEThuZ88qhV6AhJ68YTZP0RTmeNSF2BIE6pVKUPEY3CWvab490j+ f2F+Ig2klP0u+jpZqRJp+hMX/269qe613b5YEZ3rQtBs8IoRzV02OGkJz7adw+qopRGK MrIJvGe/J1FMyg8ohnViaWvcOmxIR2tmxOa5xNwPoZ5E2EQlROddCAqfqO3ulb5zkUx3 eodSI83tYjRCSZ9JSnYKCOMo0Otsx/fGohPtYKe9ndFl+mWV5d0u7vCGOoZydn1TOOvj El7auAavZgQhvlxjYe2s8pDrR0EylYou09YE8lCcZTyUJ4kjHllHASKAHHd4IjpfDBv0 1A6Q== 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:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=cLyW4DwpBu2mInWAfYk6tkTLF7yk/ilJJdyRSAzr4ZY=; b=Tn2N1H4iYfaCWSjpx2wS6eFZLtQiAHGpTe0Lp7BhfSXtlDKm5P7yAPXYKKSaoxKWzl dsPfXBHJ5vBePVSmtLm7/AXAvhR3s9mt7jZr5fGRDhogMfYUjw7BhEsUI6NYJVbUrTIp ykbWiV2qw4cBkz4AwyzMSOm9ckQ8hsJTQtwQjYiYR1HIZd8sOmdug7o9tRCUABikbs9O PgqzLHjMteKls7AoOYvzeTDLXCJqYKpzaEN3j+U5wilDoMEeMQZjWBF9Rvn0jIjZvo8r QLZf1rp8DH/M/CmsG75IlOrcu3emgl+mNqPDJg/8VeLizlqGdcU2RBJJgOP1q83aVZmc Ozpg== 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 j2si6961039wrh.359.2018.02.26.14.00.49; Mon, 26 Feb 2018 14:00:50 -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 2AFAD68A2C2; Tue, 27 Feb 2018 00:00:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-1.mx.upcmail.net (vie01a-dmta-pe08-1.mx.upcmail.net [84.116.36.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 509DF689CBE for ; Tue, 27 Feb 2018 00:00:37 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eqQp7-0003kG-2b for ffmpeg-devel@ffmpeg.org; Mon, 26 Feb 2018 23:00:41 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id Fa0X1x01p0S5wYM01a0Yrg; Mon, 26 Feb 2018 23:00:33 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 26 Feb 2018 23:00:29 +0100 Message-Id: <20180226220029.21010-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180226220029.21010-1-michael@niedermayer.cc> References: <20180226220029.21010-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/bintext: sanity check dimensions 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: 6277/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XBIN_fuzzer-6047202288861184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/bintext.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c index 90bbe67b59..d967317671 100644 --- a/libavcodec/bintext.c +++ b/libavcodec/bintext.c @@ -35,6 +35,8 @@ #include "bintext.h" #include "internal.h" +#define FONT_WIDTH 8 + typedef struct XbinContext { AVFrame *frame; int palette[16]; @@ -91,6 +93,9 @@ static av_cold int decode_init(AVCodecContext *avctx) break; } } + if (avctx->width < FONT_WIDTH || avctx->height < s->font_height) + return AVERROR_INVALIDDATA; + s->frame = av_frame_alloc(); if (!s->frame) @@ -113,8 +118,6 @@ av_unused static void hscroll(AVCodecContext *avctx) } } -#define FONT_WIDTH 8 - /** * Draw character to screen */