Skip to content

Commit 6ff72ae

Browse files
committed
fix php 72494, invalid color index not handled, can lead to crash
1 parent bca12e4 commit 6ff72ae

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: tests/gdimagecrop/php_bug_72494.c

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include "gd.h"
4+
5+
#include "gdtest.h"
6+
7+
int main()
8+
{
9+
gdImagePtr im, exp;
10+
int error = 0;
11+
12+
im = gdImageCreate(50, 50);
13+
14+
if (!im) {
15+
gdTestErrorMsg("gdImageCreate failed.\n");
16+
return 1;
17+
}
18+
19+
gdImageCropThreshold(im, 1337, 0);
20+
gdImageDestroy(im);
21+
/* this bug tests a crash, it never reaches this point if the bug exists*/
22+
return 0;
23+
}

0 commit comments

Comments
 (0)