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
This commit is contained in:
Rémi Verschelde 2024-04-22 12:53:24 +02:00
commit 8931a3ec14
No known key found for this signature in database
GPG key ID: C3336907360768E1

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