Skip to content

Commit

Permalink
Merge pull request #90912 from clayjohn/CVTT-decomp
Browse files Browse the repository at this point in the history
Avoid writing out of range data over valid data in CVTT decompress methods when decompressing small mip levels
  • Loading branch information
akien-mga committed Apr 22, 2024
2 parents 7599be9 + 98dacc1 commit 8931a3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/cvtt/image_compress_cvtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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);
Expand Down

0 comments on commit 8931a3e

Please sign in to comment.