summaryrefslogtreecommitdiff
path: root/tests/gd2/bug00354.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gd2/bug00354.c')
-rw-r--r--tests/gd2/bug00354.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/gd2/bug00354.c b/tests/gd2/bug00354.c
new file mode 100644
index 0000000..1bce091
--- /dev/null
+++ b/tests/gd2/bug00354.c
@@ -0,0 +1,30 @@
+/**
+ * We're testing GD2 image files which report illegal chunk counts. These should
+ * not cause integer overflows or other issues, but instead simply fail to be
+ * loaded.
+ *
+ * See also <https://github.com/libgd/libgd/issues/354>.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+
+ fp = gdTestFileOpen2("gd2", "bug00354a.gd2");
+ gdTestAssert(fp != NULL);
+ im = gdImageCreateFromGd2(fp);
+ gdTestAssert(im == NULL);
+ fclose(fp);
+
+ fp = gdTestFileOpen2("gd2", "bug00354b.gd2");
+ gdTestAssert(fp != NULL);
+ im = gdImageCreateFromGd2(fp);
+ gdTestAssert(im == NULL);
+ fclose(fp);
+
+ return gdNumFailures();
+}