--- /dev/null
+#include <cstdint>
+
+#include <Magick++/Blob.h>
+#include <Magick++/Image.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ uint16_t Width;
+ uint16_t Height;
+ if (Size < (sizeof(Width) + sizeof(Height))) {
+ return 0;
+ }
+ Width = *reinterpret_cast<const uint16_t *>(Data);
+ Height = *reinterpret_cast<const uint16_t *>(Data + sizeof(Width));
+ const Magick::Blob blob(Data + sizeof(Width) + sizeof(Height),
+ Size - (sizeof(Width) + sizeof(Height)));
+ Magick::Image image;
+ try {
+ image.read(blob);
+ } catch (Magick::Exception &e) {
+ return 0;
+ }
+ image.crop(Magick::Geometry(Width, Height));
+ return 0;
+}
--- /dev/null
+#include <cstdint>
+
+#include <Magick++/Blob.h>
+#include <Magick++/Image.h>
+
+#define FUZZ_ENCODER_STRING_LITERAL(name) #name
+#define FUZZ_ENCODER FUZZ_ENCODER_STRING_LITERAL(FUZZ_IMAGEMAGICK_ENCODER)
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ const Magick::Blob blob(Data, Size);
+ Magick::Image image;
+ try {
+ image.read(blob);
+ } catch (Magick::Exception &e) {
+ return 0;
+ }
+
+ Magick::Blob outBlob;
+ try {
+ image.write(&outBlob, FUZZ_ENCODER);
+ } catch (Magick::Exception &e) {
+ }
+ return 0;
+}
--- /dev/null
+#include <iostream>
+
+#include <Magick++/Blob.h>
+#include <Magick++/Image.h>
+
+extern "C" int main() {
+ size_t nFormats;
+ Magick::ExceptionInfo ex;
+ const Magick::MagickInfo **formats = GetMagickInfoList("*", &nFormats, &ex);
+
+ for (size_t i = 0; i < nFormats; i++) {
+ const Magick::MagickInfo *format = formats[i];
+ if (format->encoder && format->name) {
+ std::cout << format->name << std::endl;
+ }
+ }
+}
--- /dev/null
+#include <cstdint>
+
+#include <Magick++/Blob.h>
+#include <Magick++/Image.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ const Magick::Blob blob(Data, Size);
+ Magick::Image image;
+ try {
+ image.read(blob);
+ image.enhance();
+ } catch (Magick::Exception &e) {
+ return 0;
+ }
+ return 0;
+}
--- /dev/null
+#include <cstdint>
+
+#include <Magick++/Blob.h>
+#include <Magick++/Image.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ const Magick::Blob blob(Data, Size);
+ Magick::Image image;
+ try {
+ image.read(blob);
+ } catch (Magick::Exception &e) {
+ return 0;
+ }
+ Magick::ExceptionInfo ex;
+ auto res = HuffmanDecodeImage(image.image(), &ex);
+ return 0;
+}
--- /dev/null
+#include <cstdint>
+
+#include <Magick++/Blob.h>
+#include <Magick++/Image.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ if (Size < sizeof(double)) {
+ return 0;
+ }
+ double Degrees = *reinterpret_cast<const double *>(Data);
+ if (!isfinite(Degrees)) {
+ return 0;
+ }
+ const Magick::Blob blob(Data + sizeof(Degrees), Size - sizeof(Degrees));
+ Magick::Image image;
+ try {
+ image.read(blob);
+ } catch (Magick::Exception &e) {
+ return 0;
+ }
+ image.rotate(Degrees);
+ return 0;
+}