Author: AlbrechtS
Date: 2011-05-23 14:05:22 -0700 (Mon, 23 May 2011)
New Revision: 8731
Log:
Fix STR #2637, part 2: accessing pixel values beyond array bounds. 64-bit
converters to X image formats would access one more pixel per line
for images with odd widths.


Modified:
   branches/branch-1.3/src/fl_draw_image.cxx

Modified: branches/branch-1.3/src/fl_draw_image.cxx
===================================================================
--- branches/branch-1.3/src/fl_draw_image.cxx   2011-05-23 19:40:23 UTC (rev 
8730)
+++ branches/branch-1.3/src/fl_draw_image.cxx   2011-05-23 21:05:22 UTC (rev 
8731)
@@ -297,13 +297,15 @@
 #    if WORDS_BIGENDIAN
 #      define INNARDS32(f) \
   U64 *t = (U64*)to; \
-  int w1 = (w+1)/2; \
-  for (; w1--; from += delta) {U64 i = f; from += delta; *t++ = (i<<32)|(f);}
+  int w1 = w/2; \
+  for (; w1--; from += delta) {U64 i = f; from += delta; *t++ = (i<<32)|(f);} \
+  if (w&1) *t++ = (U64)(f)<<32;
 #    else
 #      define INNARDS32(f) \
   U64 *t = (U64*)to; \
-  int w1 = (w+1)/2; \
-  for (; w1--; from += delta) {U64 i=f; from+= delta; *t++ = ((U64)(f)<<32)|i;}
+  int w1 = w/2; \
+  for (; w1--; from += delta) {U64 i = f; from += delta; *t++ = 
((U64)(f)<<32)|i;} \
+  if (w&1) *t++ = (U64)(f);
 #    endif
 #  else
 #    define STORETYPE U32

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to