gimp r25187 - in branches/gimp-2-4: . plug-ins/common



Author: neo
Date: Sun Mar 23 23:17:48 2008
New Revision: 25187
URL: http://svn.gnome.org/viewvc/gimp?rev=25187&view=rev

Log:
2008-03-24  Sven Neumann  <sven gimp org>

	Merged from trunk:

	* plug-ins/common/dicom.c (dicom_loader): fixed potential crash 
on
	empty 16 bit images.



Modified:
   branches/gimp-2-4/ChangeLog
   branches/gimp-2-4/plug-ins/common/dicom.c

Modified: branches/gimp-2-4/plug-ins/common/dicom.c
==============================================================================
--- branches/gimp-2-4/plug-ins/common/dicom.c	(original)
+++ branches/gimp-2-4/plug-ins/common/dicom.c	Sun Mar 23 23:17:48 2008
@@ -544,13 +544,12 @@
   gint     samples_per_pixel = info->samples_per_pixel;
   guint16 *buf16             = (guint16 *) pix_buffer;
   gint     pix_idx;
-  guint16  max               = 0;
+  guint16  max               = 1;
 
   if (info->bpp == 16)
     {
       /* Reorder the buffer and look for max */
-      max = 0;
-      for (pix_idx=0; pix_idx < width * height * samples_per_pixel; pix_idx++)
+      for (pix_idx = 0; pix_idx < width * height * samples_per_pixel; pix_idx++)
 	{
 	  guint pix_gl = g_ntohs (GUINT16_SWAP_LE_BE (buf16[pix_idx]));
 
@@ -582,7 +581,7 @@
 
 	      for (col_idx = 0; col_idx < width * samples_per_pixel; col_idx++)
 		d[col_idx] =
-                  (guint8) (255.0 * (gdouble)(row_start[col_idx]) / max);
+                  (guint8) (255.999 * (gdouble) (row_start[col_idx]) / max);
 	    }
 	  else if (info->bpp == 8)
 	    {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]