Skip to content
Myr

stb_image: fix gcc bounds-check warning (believed erroneous)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by GitHub · parent 449758b · Browse files · 1 file+6 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−3 removed

  • other:+6 added−3 removed

1 file+6 added−3 removed

modified:stb_image.h+6 added-3 removed
1/* stb_image - v2.29 - public domain image loader - http://nothings.org/stb1/* stb_image - v2.30 - public domain image loader - http://nothings.org/stb2 no warranty implied; use at your own risk34 Do this:5 #define STB_IMAGE_IMPLEMENTATION
41 unmodified lines
47 See end of file for license information.4849RECENT REVISION HISTORY:5051 2.30 (2024-05-31) avoid erroneous gcc warning52 2.29 (2023-05-xx) optimizations53 2.28 (2023-01-29) many error fixes, security errors, just tons of stuff54 2.27 (2021-07-11) document stbi_info better, 16-bit PNM support, bug fixes55 2.26 (2020-07-13) many minor fixes
5103 unmodified lines
5159 has_trans = 1;5160 // non-paletted with tRNS = constant alpha. if header-scanning, we can stop now.5161 if (scan == STBI__SCAN_header) { ++s->img_n; return 1; }5162 if (z->depth == 16) {5162 for (k = 0; k < s->img_n; ++k) tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is5163 for (k = 0; k < s->img_n && k < 3; ++k) // extra loop test to suppress false GCC warning5164 tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is5165 } else {5166 for (k = 0; k < s->img_n && k < 3; ++k)5164 for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger5167 tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger5168 }5169 }5170 break;5171 }
2817 unmodified lines