[Freeciv-Dev] (PR#13374) gui-xaw and png_get_tRNS problem
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#13374) gui-xaw and png_get_tRNS problem |
From: |
"Egor Vyscrebentsov" <evyscr@xxxxxxxxx> |
Date: |
Wed, 29 Jun 2005 12:37:51 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13374 >
Good daytime!
In gui-xaw client from current CVS HEAD, if we have corrupted png
transparent array than civclient crashes. Attached patch allows
civclient to continue to work.
Many thanks for Jason.
--
Thanks, evyscr.
Index: client/gui-xaw/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/graphics.c,v
retrieving revision 1.66
diff -u -r1.66 graphics.c
--- client/gui-xaw/graphics.c 15 Jun 2005 21:47:33 -0000 1.66
+++ client/gui-xaw/graphics.c 29 Jun 2005 19:35:31 -0000
@@ -335,7 +335,7 @@
int has_mask;
png_byte color_type;
png_byte alpha;
- bool pixel;
+ bool pixel, reported;
fp = fopen(filename, "rb");
if (!fp) {
@@ -404,8 +404,16 @@
ptransarray = fc_calloc(npalette, sizeof(*ptransarray));
+ reported = FALSE;
for (i = 0; i < ntrans; i++) {
- ptransarray[trans[i]] = TRUE;
+ if (trans[i] < npalette) {
+ ptransarray[trans[i]] = TRUE;
+ } else if (!reported) {
+ freelog(LOG_VERBOSE,
+ "PNG: Trasparent array entry is out of palette. File: %s",
+ filename);
+ reported = TRUE;
+ }
}
} else {
ptransarray = NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13374) gui-xaw and png_get_tRNS problem,
Egor Vyscrebentsov <=
|
|