summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-08-31 18:48:20 +0700
committerGitHub <noreply@github.com>2021-08-31 18:48:20 +0700
commit9251cd60d0414027b634090d3ccc4bc846fb8eef (patch)
treede8e37b0529edf440c254085acdcc92236df4fee /tests
parentdeb696dbef8389f75c2924df85b7a3dac56fbe29 (diff)
parent4cd5542152afa8409e688297164a08bf03440197 (diff)
downloadlibgd-9251cd60d0414027b634090d3ccc4bc846fb8eef.tar.gz
Merge pull request #736 from libgd/bug/415
Fix #415, Assuming TopOfs and LeftOfs zero, we can safely skip any (x…
Diffstat (limited to 'tests')
-rw-r--r--tests/gif/CMakeLists.txt1
-rw-r--r--tests/gif/bug00415.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/gif/CMakeLists.txt b/tests/gif/CMakeLists.txt
index d071874..8349ace 100644
--- a/tests/gif/CMakeLists.txt
+++ b/tests/gif/CMakeLists.txt
@@ -11,6 +11,7 @@ LIST(APPEND TESTS_FILES
bug00006
bug00060
gif_im2im
+ bug00415
)
IF(PNG_FOUND)
diff --git a/tests/gif/bug00415.c b/tests/gif/bug00415.c
new file mode 100644
index 0000000..e95df28
--- /dev/null
+++ b/tests/gif/bug00415.c
@@ -0,0 +1,27 @@
+#include <gd.h>
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im1, im2;
+
+ im1 = gdImageCreate(100, 100);
+ gdImageColorAllocate(im1, 0, 0, 0);
+ im2 = gdImageCreate(10, 10);
+ gdImageColorAllocate(im2, 255, 255, 255);
+
+ FILE *fp = gdTestTempFp();
+ if (!fp) return 4;
+ gdImageGifAnimBegin(im1, fp, 0, 0);
+ gdImageGifAnimAdd(im1, fp, 1, 0, 0, 100, 1, NULL);
+ gdImageGifAnimAdd(im2, fp, 1, 0, 0, 100, 1, im1);
+ // replacing `im2` with `NULL` in the following line succeeds
+ gdImageGifAnimAdd(im1, fp, 1, 0, 0, 100, 1, im2);
+ gdImageGifAnimEnd(fp);
+ fclose(fp);
+
+ gdImageDestroy(im1);
+ gdImageDestroy(im2);
+
+ return 0;
+} \ No newline at end of file