From 02a07caca4c33c76c8174d6bc8e2edbd9e8c4a0d Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 28 Jul 2017 20:30:43 +0900 Subject: [PATCH] etc to rgba conversion - dont read stack garbage into the est imgs surprising this wasn't caught when testing fallbacks. etc2 is used hyper-rarely but still... basically it'd skip pixels and read stack junk (which really would not crash but we'd have junk in image data). or should. found by PVS studio @fix --- src/static_libs/draw/draw_convert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static_libs/draw/draw_convert.c b/src/static_libs/draw/draw_convert.c index 1c65f4df43..81c727fd7d 100644 --- a/src/static_libs/draw/draw_convert.c +++ b/src/static_libs/draw/draw_convert.c @@ -315,7 +315,7 @@ _convert_etc2_rgb8_to_argb8888(void *dst, const void *src, int w, int h, { rg_etc2_rgb8_decode_block(in, bgra); for (k = 0; k < 4; k++) - memcpy(out + x + k * out_step, bgra + k * 16, 16); + memcpy(out + x + k * out_step, bgra + (k * 4), 16); } } @@ -347,7 +347,7 @@ _convert_etc2_rgba8_to_argb8888(void *dst, const void *src, int w, int h, { rg_etc2_rgba8_decode_block(in, bgra); for (k = 0; k < 4; k++) - memcpy(out + x + k * out_step, bgra + k * 16, 16); + memcpy(out + x + k * out_step, bgra + (k * 4), 16); } out += out_step * 4; }