From patchwork Wed Nov 8 18:17:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 5974 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp1071397jah; Wed, 8 Nov 2017 10:18:27 -0800 (PST) X-Google-Smtp-Source: ABhQp+SwlNjO1gdP7hQ89Hd+ayyiip5EKeh+rH4odEqcYEK4NJ/iD5EdIu64CVyDXi2NuDpjXRw7 X-Received: by 10.223.164.20 with SMTP id d20mr64575wra.103.1510165107404; Wed, 08 Nov 2017 10:18:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510165107; cv=none; d=google.com; s=arc-20160816; b=a7rssrw32dcKkvXUiXq5NQkP2sJd4hViQgoX35OUO3l5areFgs7ijRKVngeLOCsh/x BUdbL34uz2N/LWSOQM0zB67h45V/xbmujfugNQ04EQ+jpZgK02eQEIDagJrNWZICCUhx jt9oRBodyarmrXlJR2L486Kmix8WXEyrETiLdfhxWHFXhTaGqieSWKR4/IfuCiScwq/q SVhiwtk9H+BOUvtnM3vIniSxP/rqJe7jO99+4vsb+czEg8hTBO0GGpKDBFQidt3/Ugxk c3f8rmYO+HrfuaXowm/CH7EQqE0XQIyDAIUJxUpmWEkASo3uQtfyfXLZ7RdBIBcJE+Or VbuQ== 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:cc: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:dkim-signature:delivered-to:arc-authentication-results; bh=kuyAyFmDeWIZhy7jWMgohcHnF/2i110YeTftEsx/W8M=; b=sxL7Z9bZoWDBaCoZ+f8VJQeBwr7QKt49a6A+Z3NDGDEFCUODlmoOESpSIe+0wC0WPN tGpCaKVw04L5EVQnJao/8JDPNfu57KcTQ/68Y9mtXC/v+J0BktKLz2FDpub2qRFzvDVm boaoQ7VZNCUtdLDSPaGHDq+sQYpjaKbYcNsiPhhCdODuZioS/KM+Wi6lZan9OLp8EFYa nMti2mMhE3zhXDEKEui0mMxdY5PL+CzREwR62ZNrCGJu+PX0L34uHzUUEHEGCsG18Gd8 g6FTUb80kGeBeP+ZBVUdTMYKawO8d1eG9ujH26XAlXnJmgI8pwbyvR7Yi+1uVp7X/ex3 9Img== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=MfIiDw88; 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 x3si3806523wrd.245.2017.11.08.10.18.26; Wed, 08 Nov 2017 10:18:27 -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; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=MfIiDw88; 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 D9AD1689E2E; Wed, 8 Nov 2017 20:18:02 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 17099689C32 for ; Wed, 8 Nov 2017 20:17:56 +0200 (EET) Received: from localhost.localdomain (ip4d15a587.dynamic.kabel-deutschland.de [77.21.165.135]) by btbn.de (Postfix) with ESMTPSA id ABA3D1115F4; Wed, 8 Nov 2017 19:18:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1510165088; bh=nPgH8p2a9JFNXQfaq37hJo9RcwuU1557+ohn0AqBFuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MfIiDw88ryoYR/cELFQyggQ46544SeytexVK4fzVIcG5lvKPAlpOK31Si5ntPKjk0 n8Zq+JF1lwGF6iCsnxl9pUw9kMvnRPJJ6d+/4TVNBZVfGhRk4CftSjZEWZka5auUJT G38FA16Ls64cU8gMQX2gGK4Jsh6faUeXtrn1g/QI= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Wed, 8 Nov 2017 19:17:45 +0100 Message-Id: <20171108181753.6776-2-timo@rothenpieler.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171108181753.6776-1-timo@rothenpieler.org> References: <20171108181753.6776-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 1/9] lavfi/paletteuse: check get_color return value 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 Cc: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes CID #1420396 --- libavfilter/vf_paletteuse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c index ed80ab04d5..1980907e70 100644 --- a/libavfilter/vf_paletteuse.c +++ b/libavfilter/vf_paletteuse.c @@ -380,8 +380,11 @@ static av_always_inline int get_dst_color_err(PaletteUseContext *s, const uint8_t r = c >> 16 & 0xff; const uint8_t g = c >> 8 & 0xff; const uint8_t b = c & 0xff; + uint32_t dstc; const int dstx = color_get(s, c, a, r, g, b, search_method); - const uint32_t dstc = s->palette[dstx]; + if (dstx < 0) + return dstx; + dstc = s->palette[dstx]; *er = r - (dstc >> 16 & 0xff); *eg = g - (dstc >> 8 & 0xff); *eb = b - (dstc & 0xff);