* [FFmpeg-devel] [PR] avcodec/notchlc: zero-initialize history buffer (PR #21367)
@ 2026-01-03 18:57 Timo Rothenpieler via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Timo Rothenpieler via ffmpeg-devel @ 2026-01-03 18:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Timo Rothenpieler
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-03 18:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-03 18:57 [FFmpeg-devel] [PR] avcodec/notchlc: zero-initialize history buffer (PR #21367) Timo Rothenpieler via ffmpeg-devel
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