Merge branch 'fuzz' of https://github.com/randy408/stb into work2

This commit is contained in:
Sean Barrett 2020-02-02 08:00:39 -08:00
commit c046a25fd7
10 changed files with 29 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

8
tests/stb_png.dict Normal file
View File

@ -0,0 +1,8 @@
header_png="\x89PNG\x0d\x0a\x1a\x0a"
section_idat="IDAT"
section_iend="IEND"
section_ihdr="IHDR"
section_plte="PLTE"
section_trns="tRNS"
section_cgbi="CgBI"

View File

@ -0,0 +1,19 @@
#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_PNG
#include "../stb_image.h"
extern "C" 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;
}

View File

@ -0,0 +1,2 @@
[libfuzzer]
dict = stb_png.dict