Browse Source

add fuzz target, dictionary, iphone png's

Randy 6 years ago
parent
commit
cd797f8116

BIN
tests/pngsuite/iphone/iphone_basi0g01.png


BIN
tests/pngsuite/iphone/iphone_basi0g02.png


BIN
tests/pngsuite/iphone/iphone_basi3p02.png


BIN
tests/pngsuite/iphone/iphone_bgwn6a08.png


BIN
tests/pngsuite/iphone/iphone_bgyn6a16.png


BIN
tests/pngsuite/iphone/iphone_tbyn3p08.png


BIN
tests/pngsuite/iphone/iphone_z06n2c08.png


+ 30 - 0
tests/stb_png.dict

@@ -0,0 +1,30 @@
+header_png="\x89PNG\x0d\x0a\x1a\x0a"
+
+section_idat="IDAT"
+section_iend="IEND"
+section_ihdr="IHDR"
+section_plte="PLTE"
+section_trns="tRNS"
+section_chrm="cHRM"
+section_gama="gAMA"
+section_iccp="iCCP"
+section_sbit="sBIT"
+section_srgb="sRGB"
+section_text="tEXt"
+section_ztxt="zTXt"
+section_itxt="iTXt"
+section_bkgd="bKGD"
+section_hist="hIST"
+section_phys="pHYs"
+section_splt="sPLT"
+section_time="tIME"
+section_offs="oFFs"
+section_exif="eXIf"
+section_frac="fRAc"
+section_pcal="pCAL"
+section_scal="sCAL"
+section_ster="sTER"
+section_gifg="gIFg"
+section_gift="gIFt"
+section_gifx="gIFx"
+section_cgbi="CgBI"

+ 19 - 0
tests/stb_png_read_fuzzer.cpp

@@ -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;
+}

+ 2 - 0
tests/stb_png_read_fuzzer.options

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