Skip to content
Myr

more cases of STB_NO_HDR and STB_NO_LINEAR interfering

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

authored by Sean Barrett · committed by Sean Barrett · parent 40f43af · Browse files · 1 file+3 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+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:stb_image.h+3 added-3 removed
902 unmodified lines
903 stbi__addsizes_valid(a*b*c, add);904}905906// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow907#if !defined(STBI_NO_LINEAR) && !defined(STBI_NO_HDR)907#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)908static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)909{910 return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&911 stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);
12 unmodified lines
924 if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL;925 return stbi__malloc(a*b*c + add);926}927928#if !defined(STBI_NO_LINEAR) && !defined(STBI_NO_HDR)928#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)929static void *stbi__malloc_mad4(int a, int b, int c, int d, int add)930{931 if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL;932 return stbi__malloc(a*b*c*d + add);
196 unmodified lines
11291130 return (stbi__uint16 *) result;1131}11321133#if !defined(STBI_NO_HDR) && !defined(STBI_NO_LINEAR)1133#if !defined(STBI_NO_HDR) || !defined(STBI_NO_LINEAR)1134static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp)1135{1136 if (stbi__vertically_flip_on_load && result != NULL) {1137 int channels = req_comp ? req_comp : *comp;
6322 unmodified lines