Browse Source

stb_image: UB fix in stbi__get32le

Need to do the second-part shift on uint32 not int.
Fabian Giesen 4 years ago
parent
commit
41e93836d9
1 changed files with 2 additions and 1 deletions
  1. 2 1
      stb_image.h

+ 2 - 1
stb_image.h

@@ -1674,7 +1674,8 @@ static int stbi__get16le(stbi__context *s)
 static stbi__uint32 stbi__get32le(stbi__context *s)
 static stbi__uint32 stbi__get32le(stbi__context *s)
 {
 {
    stbi__uint32 z = stbi__get16le(s);
    stbi__uint32 z = stbi__get16le(s);
-   return z + (stbi__get16le(s) << 16);
+   z += (stbi__uint32)stbi__get16le(s) << 16;
+   return z;
 }
 }
 #endif
 #endif