SDL_image-1.2 fix for XCF loading

This commit is contained in:
Thomas Bernard 2020-11-01 23:10:45 +01:00
parent 8c6a502589
commit 0cac68571f
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 16 additions and 0 deletions

1
3rdparty/Makefile vendored
View File

@ -38,6 +38,7 @@ SDLIMAGEURL = https://www.libsdl.org/projects/SDL_image/release/$(SDLIMAGEARCH)
SDLIMAGESHA256 = 0b90722984561004de84847744d566809dbb9daf732a9e503b91a1b5a84e5699
SDLIMAGEPATCHES = SDL_image-1.2.12.XCF_infinite_loop.patch \
SDL_image-1.2.12.XCF_v11_64bits_offsets.patch \
SDL_image-1.2.12.XCF-fixversion.patch \
SDL_image_XCF_v11_load_level.patch \
SDL_image-1.2.12-png1.6.patch \
SDL_image-1.2.12-png_const_colorp.patch \

View File

@ -0,0 +1,15 @@
diff -r 5d581cd9e075 IMG_xcf.c
--- a/IMG_xcf.c Sun Oct 25 23:55:10 2020 +0300
+++ b/IMG_xcf.c Mon Oct 26 23:25:39 2020 +0100
@@ -336,7 +336,10 @@
h->width = SDL_ReadBE32 (src);
h->height = SDL_ReadBE32 (src);
h->image_type = SDL_ReadBE32 (src);
- h->file_version = (h->sign[10] - '0') * 100 + (h->sign[11] - '0') * 10 + (h->sign[12] - '0');
+ if (h->sign[9] == 'v' && h->sign[10] >= '0' && h->sign[10] <= '9' && h->sign[11] >= '0' && h->sign[11] <= '9' && h->sign[12] >= '0' && h->sign[12] <= '9')
+ h->file_version = (h->sign[10] - '0') * 100 + (h->sign[11] - '0') * 10 + (h->sign[12] - '0');
+ else
+ h->file_version = 0;
#ifdef DEBUG
printf ("XCF signature : %.14s (version %u)\n", h->sign, h->file_version);
printf (" (%u,%u) type=%u\n", h->width, h->height, h->image_type);