1 #include <Magick++/Functions.h> 2 #include <Magick++/ResourceLimits.h> 3 #include <Magick++/SecurityPolicy.h> 4 5 #ifndef FUZZ_MAX_SIZE 6 #define FUZZ_MAX_SIZE 2048 7 #endif 8 9 class FuzzingInitializer { 10 public: FuzzingInitializer()11 FuzzingInitializer() { 12 13 // Disable SIMD in jpeg turbo. 14 (void) putenv(const_cast<char *>("JSIMD_FORCENONE=1")); 15 16 Magick::InitializeMagick((const char *) NULL); 17 Magick::SecurityPolicy::anonymousCacheMemoryMap(); 18 Magick::SecurityPolicy::anonymousSystemMemoryMap(); 19 Magick::SecurityPolicy::maxMemoryRequest(256000000); 20 Magick::ResourceLimits::memory(1000000000); 21 Magick::ResourceLimits::map(500000000); 22 Magick::ResourceLimits::width(FUZZ_MAX_SIZE); 23 Magick::ResourceLimits::height(FUZZ_MAX_SIZE); 24 Magick::ResourceLimits::listLength(16); 25 } 26 }; 27 28 FuzzingInitializer fuzzingInitializer; 29 30 #if BUILD_MAIN 31 #include "encoder_format.h" 32 33 EncoderFormat encoderFormat; 34 35 #define FUZZ_ENCODER encoderFormat.get() 36 #endif // BUILD_MAIN 37