[Image-SIG] Bug in PIL's quantize()
Germán M. Bravo
german.mb at gmail.com
Thu Jun 21 00:55:38 CEST 2012
I found a nasty bug in PIL's quantize(), in Quant.c,
map_image_pixels_from_median_box(), the `int pixelVal;` definition
must be `unsigned long pixelVal;` instead... This was making PIL crash
under certain circumstances in my system (64 bit Mac OS X Lion 10.7.4
using llvm-gcc4.2).
Patch follows:
-------- CUT HERE --------
--- libImaging/Quant.c.orig 2012-06-20 17:53:49.000000000 -0500
+++ libImaging/Quant.c 2012-06-20 17:53:51.000000000 -0500
@@ -914,7 +914,7 @@
unsigned long bestdist,bestmatch,dist;
unsigned long initialdist;
HashTable h2;
- int pixelVal;
+ unsigned long pixelVal;
h2=hashtable_new(unshifted_pixel_hash,unshifted_pixel_cmp);
for (i=0;i<nPixels;i++) {
-------- CUT HERE --------
More information about the Image-SIG
mailing list