diff options
author | wilson chen <willson.chenwx@gmail.com> | 2020-05-20 19:29:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 19:29:23 +0800 |
commit | bc658270f5e8a2446ab9e218a0ce87570b9dfdea (patch) | |
tree | a71cf1954b14af089b14e90dcfb9733c27594d93 /tests | |
parent | 43df499f1f17ff403b89d85688034b66adba1331 (diff) | |
download | libgd-bc658270f5e8a2446ab9e218a0ce87570b9dfdea.tar.gz |
tests/gdimageline/gdimageline_bug5: add im null judgement (#624)
gdImageCreate returns NULL in gdimageline_bug5.c on AIX, which make the judgement necessary in case of segment fault.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gdimageline/gdimageline_bug5.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/gdimageline/gdimageline_bug5.c b/tests/gdimageline/gdimageline_bug5.c index 44adc8e..d055b0c 100644 --- a/tests/gdimageline/gdimageline_bug5.c +++ b/tests/gdimageline/gdimageline_bug5.c @@ -10,7 +10,13 @@ int main() { /* FILE *pngout; */ int black, white; + /* If the data seg size is less than 195000, + * gdImageCrateTrueColor will return NULL. + * See https://github.com/libgd/libgd/issues/621 */ im = gdImageCreateTrueColor(63318, 771); + if (gdTestAssertMsg(im != NULL, "gdImageCreateTrueColor() returns NULL\n") == 0) { + return gdNumFailures(); + } /* Allocate the color white (red, green and blue all maximum). */ white = gdImageColorAllocate(im, 255, 255, 255); |