bfaccab17a 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'stb-image-fuzzing-fixes' of  https://github.com/rcgordon/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								58b2e1490d 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'fix_alloca' of  https://github.com/Clownacy/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								ce54bbc454 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'master' of  https://github.com/AdamKorcz/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								0ccb4f0071 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'rg-matchcolors' of  https://github.com/castano/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								5a8702567a 
								
							
								 
							
						 
						
							
							
								
								credit for PR  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								da888065bf 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'master' of  https://github.com/Vawx/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								fb1cea02f8 
								
							
								 
							
						 
						
							
							
								
								tweak PR  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								add7adc3ea 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'patch-1' of  https://github.com/vickit144/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								fd9c3ea4af 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'bmp-assert' of  https://github.com/zturtleman/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								6f7420a825 
								
							
								 
							
						 
						
							
							
								
								add credits for last few PR merges  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								67881b61ab 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'stbds-arraddn' of  https://github.com/HeroicKatora/stb  into working  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								1c816743b6 
								
							
								 
							
						 
						
							
							
								
								make PR compile in MSVC6  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								cae8e852f6 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'perfect-endpoint-quantization' of  https://github.com/castano/stb  into test  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								cae97bdb17 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'alloca-fix' of  https://github.com/mackron/stb  into test  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								fdafd1aab4 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'loadgif-realloc-sized' of  https://github.com/SasLuca/stb  into test  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								b3a74a5c8a 
								
							
								 
							
						 
						
							
							
								
								fix PR to work on VC6  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								206529e08e 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'unused#801' of  https://github.com/hashitaku/stb  into test  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								dfdb7d9c14 
								
							
								 
							
						 
						
							
							
								
								stb_ds: use keyoffset in key comparison  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								523a14f3e1 
								
							
								 
							
						 
						
							
							
								
								stb_image_write: small buffer to avoid calling fwrite on every pixel  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								802a1df278 
								
							
								 
							
						 
						
							
							
								
								tweak indentation  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								c5b527aa01 
								
							
								 
							
						 
						
							
							
								
								modern seeding of mersenne twister  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								1e400e21d2 
								
							
								 
							
						 
						
							
							
								
								stb_ds: fix shputs() for strdup and arena hash table  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								c24de24aa8 
								
							
								 
							
						 
						
							
							
								
								stb_vorbis: Add missing error checks in comment reading mallocs  
							
							... 
							
							
 
							
							Fixes  #988 . 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								3b14b5afa6 
								
									
								
							
								 
							
						 
						
							
							
								
								Update Makefile  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								c8303509fa 
								
							
								 
							
						 
						
							
							
								
								make fuzz target compilable as c++ code  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								9cd6cdc0e5 
								
							
								 
							
						 
						
							
							
								
								add ossfuzz build script  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								a6b384358f 
								
							
								 
							
						 
						
							
							
								
								Merge branch 'fuzzer_updates' of  https://github.com/randy408/stb  into fuzzer_updates  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								a7fed59fe4 
								
							
								 
							
						 
						
							
							
								
								add fuzz target to Makefile  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								9e292f0731 
								
									
								
							
								 
							
						 
						
							
							
								
								Fix minor typo in comment on line 6532  
							
							
 
							
						 
						
							ago%!(EXTRA string=5 years)  
				
					
						
							
							
								 
						
							
							
								ec898982b0 
								
							
								 
							
						 
						
							
							
								
								stbi: use __thread if GCC can't use _Thread_local  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								8cb98357de 
								
							
								 
							
						 
						
							
							
								
								stbi: fix thread local selector  
							
							... 
							
							
 
							
							* GCC < 5 supports __thread and GCC >= 5 supports C11 with _Thread_local
* Skip _Thread_local for MSVC because it may not be supported 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								d1d0e9fdb0 
								
							
								 
							
						 
						
							
							
								
								add fuzz target to Makefile  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								5a7af50fa5 
								
							
								 
							
						 
						
							
							
								
								remove stb_png_read_fuzzer.options  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								88062723ff 
								
							
								 
							
						 
						
							
							
								
								rename fuzz target  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								b75413f8a4 
								
							
								 
							
						 
						
							
							
								
								do not define STBI_ONLY_PNG in fuzz target  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								4bafa56899 
								
							
								 
							
						 
						
							
							
								
								rename fuzz target, add entry point  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								2d0faa4d26 
								
							
								 
							
						 
						
							
							
								
								stb_vorbis.c: Fix missing update to 64-bit alignment  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								c29138ba59 
								
							
								 
							
						 
						
							
							
								
								Add randy408 to the "Bug warnings & fixes" list.  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								29d639546d 
								
							
								 
							
						 
						
							
							
								
								fix integer arithmetic in stbi__zexpand()  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								b09cb2c6f5 
								
							
								 
							
						 
						
							
							
								
								Add Ryan C. Gordon to "Bug & warning fixes" contribution list.  
							
							
 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								89f3f35c9f 
								
							
								 
							
						 
						
							
							
								
								stbi__skip should return immediately if skipping zero bytes.  
							
							... 
							
							
 
							
							Otherwise we might waste time or throw away state in the i/o callbacks. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								d60594847e 
								
							
								 
							
						 
						
							
							
								
								Reject images that are too large (as defined by the application).  
							
							... 
							
							
 
							
							The BMP loader already had this hardcoded to (1 << 24) pixels, so this seems
like a good default to apply to all formats, but many apps will want to clamp
this much much lower.
It's possible to craft malicious but valid images that are enormous, causing
stb_image to allocate tons of memory and eat a ton of CPU, so locking these
to a maximum permitted size can save a lot of headaches in the wild. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								98ca24b8c7 
								
							
								 
							
						 
						
							
							
								
								Turn several asserts into formal checks.  
							
							... 
							
							
 
							
							There are several places where stb_image protects itself from bad data with
STBI_ASSERT macros, but if these are compiled out in release builds the code
will overflow buffers, etc, without warning. If they are left enabled, the
process will crash from assertion failures.
This patch attempts to leave the assertions in place that are meant to verify
the correctness of the interfaces (if the calling function was meant to pass
only 8 or 16 for bit depth, it's reasonable to assert that is accurate), but
changes asserts that are triggered by corrupt or malicious image file data.
Failed asserts were the majority of crashes during fuzzing; now all of these
cases safely report an error back to the calling app. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								95560bc6cf 
								
							
								 
							
						 
						
							
							
								
								Be more aggressive about unexpected EOF conditions.  
							
							... 
							
							
 
							
							Fixes several hangs in the presence of bad input data. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								eb4b057f0d 
								
							
								 
							
						 
						
							
							
								
								Check a return value for errors.  
							
							... 
							
							
 
							
							Catches bad input data found during fuzzing. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								b5d2296d5d 
								
							
								 
							
						 
						
							
							
								
								Check for some obviously bad inputs from corrupt/malicious data.  
							
							... 
							
							
 
							
							These all caused crashes during fuzzing. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								385b5d3cda 
								
							
								 
							
						 
						
							
							
								
								stbi__stdio_eof() should check ferror(), too.  
							
							... 
							
							
 
							
							Otherwise with filesystem errors, you might end up with a short read but
believe there's still more to read from the file, causing infinite loops. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								00f3f01be3 
								
							
								 
							
						 
						
							
							
								
								fseek() resets the EOF flag, even if seeking past the end of a read-only file.  
							
							... 
							
							
 
							
							This causes problems when stb_image tries to do this with stdio callbacks with
a maliciously crafted file (or just an unfortunately corrupt one)...
    // calls fread(), sets EOF flag, sets s->read_from_callbacks = 0
    stbi__refill_buffer(s);
    // calls fseek(), which resets the stream's EOF flag
    stbi__skip(some value we just read)
    // calls feof(), which always returns false because EOF flag was reset.
    while (!stbi__at_eof(s)) {
        // never calls fread() because s->read_from_callbacks==0
        stbi__refill_buffer(s);
        // loop forever
    }
To work around this, after seeking, we call fgetc(), which will set the EOF
flag as appropriate, and if not at EOF, we ungetc the byte so future reads
are correct. This fixes the infinite loop. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								d8df5e9974 
								
							
								 
							
						 
						
							
							
								
								Add myself to the list of contributors  
							
							... 
							
							
 
							
							The pull-request template says to do so. 
							
						 
						
							ago%!(EXTRA string=6 years)  
				
					
						
							
							
								 
						
							
							
								47a3c4f5b5 
								
							
								 
							
						 
						
							
							
								
								stb_vorbis.c - Detect `__NEWLIB__` for `alloca.h`  
							
							... 
							
							
 
							
							This is needed for `stb_vorbis.c` to compile for the Wii U using
devkitPro.
This should theoretically also fix compilation for the Nintendo
Switch, 3DS, and Wii (with devkitPro, that is) as they all also use
Newlib.
Newlib is also used by Cygwin:
https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/alloca.h;h=5d36318914282280b353aed457e1b1f64947b584;hb=HEAD 
And the Google Native Client:
https://chromium.googlesource.com/native_client/nacl-newlib/+/refs/heads/master/newlib/libc/include/alloca.h 
As you can see from these links, these both provide `alloca.h` as
well, so it appears to be a safe guarantee that `alloca.h` is
available on Newlib. 
							
						 
						
							ago%!(EXTRA string=6 years)