Squashed 'external/stb/stb/' content from commit c39c7023e

git-subtree-dir: external/stb/stb
git-subtree-split: c39c7023ebb833ce099750fe35509aca5662695e
This commit is contained in:
2023-08-01 20:11:22 +02:00
commit 3cd551098b
422 changed files with 96140 additions and 0 deletions

28
tests/stbi_read_fuzzer.c Normal file
View File

@@ -0,0 +1,28 @@
#ifdef __cplusplus
extern "C" {
#endif
#define STB_IMAGE_IMPLEMENTATION
#include "../stb_image.h"
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
int x, y, channels;
if(!stbi_info_from_memory(data, size, &x, &y, &channels)) return 0;
/* exit if the image is larger than ~80MB */
if(y && x > (80000000 / 4) / y) return 0;
unsigned char *img = stbi_load_from_memory(data, size, &x, &y, &channels, 4);
free(img);
return 0;
}
#ifdef __cplusplus
}
#endif