forked from libgd/libgd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential NULL pointer dereference in gdImageClone()
- Loading branch information
1 parent
2e88604
commit 441cbfe
Showing
5 changed files
with
35 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/bug00300 | ||
/style |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
LIST(APPEND TESTS_FILES | ||
bug00300 | ||
style | ||
) | ||
|
||
ADD_GD_TESTS() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
libgd_test_programs += \ | ||
gdimageclone/bug00300 | ||
gdimageclone/bug00300 \ | ||
gdimageclone/style | ||
|
||
EXTRA_DIST += \ | ||
gdimageclone/CMakeLists.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Cloning an image should exactly reproduce all style related data | ||
*/ | ||
|
||
|
||
#include <string.h> | ||
#include "gd.h" | ||
#include "gdtest.h" | ||
|
||
|
||
int main() | ||
{ | ||
gdImagePtr im, clone; | ||
int style[] = {0, 0, 0}; | ||
|
||
im = gdImageCreate(8, 8); | ||
gdImageSetStyle(im, style, sizeof(style)/sizeof(style[0])); | ||
|
||
clone = gdImageClone(im); | ||
gdTestAssert(clone != NULL); | ||
|
||
gdTestAssert(clone->styleLength == im->styleLength); | ||
gdTestAssert(clone->stylePos == im->stylePos); | ||
gdTestAssert(!memcmp(clone->style, im->style, sizeof(style)/sizeof(style[0]))); | ||
|
||
gdImageDestroy(clone); | ||
gdImageDestroy(im); | ||
|
||
return gdNumFailures(); | ||
} |