summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-04-22 12:53:24 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-04-22 12:53:24 +0200
commit8931a3ec1471c8a42c36d902dffc31492f4c54c6 (patch)
tree3248d59c1d3c90c721795bf30259f7e53173acf9
parent7599be94371a4f5f7068c48b98c904a9aa915044 (diff)
parent98dacc14eaedc8f9d1bddd73d6fbc4c3975960f3 (diff)
downloadredot-engine-8931a3ec1471c8a42c36d902dffc31492f4c54c6.tar.gz
Merge pull request #90912 from clayjohn/CVTT-decomp
Avoid writing out of range data over valid data in CVTT decompress methods when decompressing small mip levels
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index ad70772270..e9a7009d7c 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -302,8 +302,6 @@ void image_decompress_cvtt(Image *p_image) {
int y_end = y_start + 4;
for (int x_start = 0; x_start < w; x_start += 4 * cvtt::NumParallelBlocks) {
- int x_end = x_start + 4 * cvtt::NumParallelBlocks;
-
uint8_t input_blocks[16 * cvtt::NumParallelBlocks];
memset(input_blocks, 0, sizeof(input_blocks));
@@ -315,6 +313,8 @@ void image_decompress_cvtt(Image *p_image) {
memcpy(input_blocks, in_bytes, 16 * num_real_blocks);
in_bytes += 16 * num_real_blocks;
+ int x_end = x_start + 4 * num_real_blocks;
+
if (is_hdr) {
if (is_signed) {
cvtt::Kernels::DecodeBC6HS(output_blocks_hdr, input_blocks);