From patchwork Mon Aug 2 12:06:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 29186 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp1509106ioh; Mon, 2 Aug 2021 05:06:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl9i3q+SJIM1sQMDYx/A37vjd3J9qZv6Ksy7uv8X67lSTYKx9PxwYP0aB6Zi1+Cu3SW54e X-Received: by 2002:a17:906:1919:: with SMTP id a25mr14967335eje.161.1627905996389; Mon, 02 Aug 2021 05:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627905996; cv=none; d=google.com; s=arc-20160816; b=g0JNRrlmnSayv9uGCJdrgrmy6ap2y5dBqSC1oyUjyabYbexTAUlfG/mW6mPMmJ2ukY BrkzcLLEptGRLGp/VXfzaN3XEITIeQzqjPJOXcUR6ffjVT/256DG5jbX90DcMYQoiNJe Ftge4jvKomGxjS3FS0zubFZ2QusgTc4RKw0JPY+s5Il6MJk+KwBtsTpCRwTXGOewC9NT ea7T015ckP3KrIPSICnyPhTQ1PrxJsl62EUhBUujZurNs+kp1pVTVMq4fgEhPipVoV85 7kBVwXU6YEesM2f8LE9EkYYM9xh+JIAdalT19jH5IsLeaNhJX6Uuu1P4l4EeXSK5mTvc 93Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=jxM/xlhtB3VpvQ41bWw247CVPApEQPxikQSQDHLaDbc=; b=dO3swAIQ/NLvjeJAC3ypHqCy6BXRhD9WTMpni7lakAaTifY8d59WcILs+H88OkJJey /e1ut86CCZsLWdoyNL651os5W8bCLC8yvbTZS5PJojB33u3yeDwnngJiEsPsgwAIukwU XDaDhs8TMzBmR5IyBFKRnLQpjW/kaTZuRiki/KumdHeUfqcz3oJ2FPL27XA/vyi/dtX2 /6zGB6CCgmNfCtCBidSYSvqKLOrZ2ymvlRGEt/VWiqITtEE7SMfBFfXliW3Kbe9XRJbi SSqfHKL85yxyF7KHLEW4cQMaexJ2OGQZXxQgGU6MT50U7RpRxn0j7rtZVz/j4vQSY86H mNjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="luIMXNB/"; 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 h3si9403099ejb.234.2021.08.02.05.06.35; Mon, 02 Aug 2021 05:06:36 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="luIMXNB/"; 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 EA636688095; Mon, 2 Aug 2021 15:06:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1ED26688095 for ; Mon, 2 Aug 2021 15:06:27 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id C3C1947458; Mon, 2 Aug 2021 14:06:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1627905986; bh=92uGGRoCmg7bfyGCihhs+zwg9v1UmC+7urQNWijImZE=; h=From:To:Cc:Subject:Date:From; b=luIMXNB/oSJ3piYWoySBHfydO213Vjb+TC/sSYqVGO+PTtjAROy4eDLt2SvGtDI7B ZbSeqsr+kl2Xc5wg4WCTl63ayZTcGKi/gdubWT+EwtvZuWiYtTCRfqddCW5gYsKxZW P6UUnblkPrPQUvy10SboyLiXeiO8L8l5OengzRpM= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Aug 2021 14:06:22 +0200 Message-Id: <20210802120622.73097-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] avcodec/h264_sei: fix H.274 film grain parsing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Zdch6RmUh3F3 From: Niklas Haas The current code reads the wrong number of bits for `fg_model_id`, which causes all of the values downstream of this to contain corrupt values. Fixes: corrupt SEI values Fixes: 4ff73add5dbe6c319d693355be44df2e17a0b8bf Signed-off-by: Niklas Haas --- libavcodec/h264_sei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c index 7797f24650..329c2ea4f2 100644 --- a/libavcodec/h264_sei.c +++ b/libavcodec/h264_sei.c @@ -424,7 +424,7 @@ static int decode_film_grain_characteristics(H264SEIFilmGrainCharacteristics *h, if (h->present) { memset(h, 0, sizeof(*h)); - h->model_id = get_bits(gb, 8); + h->model_id = get_bits(gb, 2); h->separate_colour_description_present_flag = get_bits1(gb); if (h->separate_colour_description_present_flag) { h->bit_depth_luma = get_bits(gb, 3) + 8;