Skip to content

Commit e772367

Browse files
committed
Fixed security vulnerability in XCF image loader (thanks Yves!)
1 parent 045d7b9 commit e772367

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
2.0.2:
2+
Yves Younan - Fri, Oct 6, 2017 3:38:38 PM
3+
* Fixed security vulnerability in XCF image loader
24
Alexey - Tue Sep 12 00:41:53 PDT 2017
35
* Added optional support for loading images using Windows Imaging Component
46
Fabian Greffrath - Tue Sep 12 00:15:56 PDT 2017

IMG_xcf.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ static Uint32 Swap32 (Uint32 v) {
251251
}
252252

253253
static void xcf_read_property (SDL_RWops * src, xcf_prop * prop) {
254+
Uint32 len;
254255
prop->id = SDL_ReadBE32 (src);
255256
prop->length = SDL_ReadBE32 (src);
256257

@@ -274,7 +275,12 @@ static void xcf_read_property (SDL_RWops * src, xcf_prop * prop) {
274275
break;
275276
case PROP_COMPRESSION:
276277
case PROP_COLOR:
277-
SDL_RWread (src, &prop->data, prop->length, 1);
278+
if (prop->length > sizeof(prop->data)) {
279+
len = sizeof(prop->data);
280+
} else {
281+
len = prop->length;
282+
}
283+
SDL_RWread(src, &prop->data, len, 1);
278284
break;
279285
case PROP_VISIBLE:
280286
prop->data.visible = SDL_ReadBE32 (src);

0 commit comments

Comments
 (0)