From f685ee4e58cb8c611b2f9c5cc1e6422106cc2906 Mon Sep 17 00:00:00 2001 From: PopPoLoPoPpo Date: Tue, 27 Feb 2018 00:08:45 +0100 Subject: [PATCH] Fix overflow in stbi_write_hdr_core() b056850ea9118b69325d973f8aef7f843527e299 left an additional multiplication by x, leading to overflow. --- stb_image_write.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stb_image_write.h b/stb_image_write.h index c05e958..ec340a9 100644 --- a/stb_image_write.h +++ b/stb_image_write.h @@ -694,7 +694,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f s->func(s->context, buffer, len); for(i=0; i < y; i++) - stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*x*(stbi__flip_vertically_on_write ? y-1-i : i)*x); + stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*x*(stbi__flip_vertically_on_write ? y-1-i : i)); STBIW_FREE(scratch); return 1; }