Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Timo Rothenpieler via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Timo Rothenpieler <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PR] avcodec/notchlc: zero-initialize history buffer (PR #21367)
Date: Sat, 03 Jan 2026 18:57:29 -0000
Message-ID: <176746664994.25.15448467039894021663@4457048688e7> (raw)

PR #21367 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21367
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21367.patch

Otherwise a specially crafted bitstream can potentially read uninitialized stack memory.

Fixes #YWH-PGM40646-37


>From 36df0c5311558b5b79299a089b65aab167140a9c Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo@rothenpieler.org>
Date: Sat, 3 Jan 2026 19:15:39 +0100
Subject: [PATCH 1/2] avcodec/notchlc: actually use HISTORY_SIZE to initialize
 history

---
 libavcodec/notchlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index d99de1810e..82c48d2054 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -79,7 +79,7 @@ static int lz4_decompress(AVCodecContext *avctx,
                           PutByteContext *pb)
 {
     unsigned reference_pos, delta, pos = 0;
-    uint8_t history[64 * 1024];
+    uint8_t history[HISTORY_SIZE];
     int match_length;
 
     while (bytestream2_get_bytes_left(gb) > 0) {
-- 
2.49.1


>From 1829e4f171b5ac897ae2731f0a3a0ace4d5834dc Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <timo@rothenpieler.org>
Date: Sat, 3 Jan 2026 19:55:56 +0100
Subject: [PATCH 2/2] avcodec/notchlc: zero-initialize history buffer

Otherwise a specially crafted bitstream can potentially read
uninitialized stack memory.

Fixes #YWH-PGM40646-37
---
 libavcodec/notchlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 82c48d2054..c28fddcea0 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -79,7 +79,7 @@ static int lz4_decompress(AVCodecContext *avctx,
                           PutByteContext *pb)
 {
     unsigned reference_pos, delta, pos = 0;
-    uint8_t history[HISTORY_SIZE];
+    uint8_t history[HISTORY_SIZE] = { 0 };
     int match_length;
 
     while (bytestream2_get_bytes_left(gb) > 0) {
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2026-01-03 18:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176746664994.25.15448467039894021663@4457048688e7 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git