[x265] [PATCH] Fix crash in hist-scenecut for high bit-depth builds
Shashank Pathipati
shashank.pathipati at multicorewareinc.com
Fri May 2 11:28:37 UTC 2025
>From 001f6eb747eccbabc352c802ba6ef466145d649b Mon Sep 17 00:00:00 2001
From: Shashank Pathipati <shashank.pathipati at multicorewareinc.com>
Date: Fri, 2 May 2025 10:01:57 +0530
Subject: [PATCH] Fix crash in hist-scenecut for high bit-depth builds
---
source/encoder/slicetype.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/source/encoder/slicetype.cpp b/source/encoder/slicetype.cpp
index 2cbf95237..edf2b00d9 100644
--- a/source/encoder/slicetype.cpp
+++ b/source/encoder/slicetype.cpp
@@ -1562,13 +1562,16 @@ void LookaheadTLD::calculateHistogram(
{
*sum = 0;
+ uint8_t shift = X265_DEPTH - 8;
for (uint32_t verticalIdx = 0; verticalIdx < inputHeight; verticalIdx += dsFactor)
{
for (uint32_t horizontalIdx = 0; horizontalIdx < inputWidth; horizontalIdx += dsFactor)
{
- ++(histogram[inputSrc[horizontalIdx]]);
- *sum += inputSrc[horizontalIdx];
+ pixel val = inputSrc[horizontalIdx] >> shift;
+ X265_CHECK(val < HISTOGRAM_NUMBER_OF_BINS, "Pixel value out of allocated histogram range. This will lead to memory corruption.\n");
+ ++(histogram[val]);
+ *sum += val;
}
inputSrc += (stride << (dsFactor >> 1));
}
--
2.49.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250502/e1b4f564/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-crash-in-hist-scenecut-for-high-bit-depth-builds.patch
Type: application/octet-stream
Size: 1286 bytes
Desc: 0001-Fix-crash-in-hist-scenecut-for-high-bit-depth-builds.patch
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20250502/e1b4f564/attachment.obj>
More information about the x265-devel
mailing list