Avoid writing out of range data over valid data in CVTT decompress methods when decompressing small mip levels

This commit is contained in:
clayjohn 2024-04-19 10:16:36 -07:00
parent 4a0160241f
commit 98dacc14ea

View File

@ -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);