Skip to content

Commit

Permalink
tests/gdimageline/gdimageline_bug5: add im null judgement (libgd#624)
Browse files Browse the repository at this point in the history
gdImageCreate returns NULL in gdimageline_bug5.c on AIX, which make the judgement necessary in case of segment fault.
  • Loading branch information
willson-chen authored May 20, 2020
1 parent 43df499 commit bc65827
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/gdimageline/gdimageline_bug5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bc65827

Please sign in to comment.