|
|
@ -1032,7 +1032,7 @@ static int stbi__mad3sizes_valid(int a, int b, int c, int add) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow
|
|
|
|
// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow
|
|
|
|
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) |
|
|
|
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM) |
|
|
|
static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) |
|
|
|
static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && |
|
|
|
return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && |
|
|
@ -1055,7 +1055,7 @@ static void *stbi__malloc_mad3(int a, int b, int c, int add) |
|
|
|
return stbi__malloc(a*b*c + add); |
|
|
|
return stbi__malloc(a*b*c + add); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) |
|
|
|
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM) |
|
|
|
static void *stbi__malloc_mad4(int a, int b, int c, int d, int add) |
|
|
|
static void *stbi__malloc_mad4(int a, int b, int c, int d, int add) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL; |
|
|
|
if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL; |
|
|
|