From 31ba943e3fdff7aff00b55629f747121f802e8c1 Mon Sep 17 00:00:00 2001 From: Fabian Giesen Date: Fri, 2 Jul 2021 21:57:25 -0700 Subject: [PATCH] stb_image: UB fix in stbi__get32le Need to do the second-part shift on uint32 not int. --- stb_image.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stb_image.h b/stb_image.h index 82b4951..01807cc 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1674,7 +1674,8 @@ static int stbi__get16le(stbi__context *s) static stbi__uint32 stbi__get32le(stbi__context *s) { stbi__uint32 z = stbi__get16le(s); - return z + (stbi__get16le(s) << 16); + z += (stbi__uint32)stbi__get16le(s) << 16; + return z; } #endif