List Info

Thread: Bug with large images




Bug with large images
user name
2006-11-29 16:33:00
Hello.

I was trying to produce an example that wouldn't work, but
I found the error in the code instead.

I suspected that the problem was in conversion from lines
to polygons so I added some code to TraceStrokePolygon that
printed the input and the output points. Then I found some
vectors that were not converted correctly:

Input Path count=2
9524.000,381.000  9524.000,381.000

Output path count=7
9525.200,381.000  1.200,0.000  9525.200,381.000 
-1.200,0.000 
9522.800,381.000  -1.200,0.000  9525.200,381.000

It is obvious that the converted coordinates were wrong.
It also explains why most of the ghost lines came from
the top-left corner of the image.

I then debugged the function and found out that when
all points of the input path were the same, the value of n
was too large and the calculation of box_[] accsessed
unassigned memory.

Then I just added the following patch and the ghosts
disappeared.

Marko Mahnič

-----------------------------------------------
--- draw.c.orig	2006-10-23 23:02:22.000000000 +0200
+++ draw.c	2006-11-29 17:08:48.937500000 +0100
 -5223,6
+5223,8 
      if ((fabs(dx.p) >= MagickEpsilon) || (fabs(dy.p)
>= MagickEpsilon))
        break;
    }
+  if (n >= number_vertices)
+     n = number_vertices - 1;
    slope.p=0.0;
    inverse_slope.p=0.0;
    if (fabs(dx.p) <= MagickEpsilon)
-----------------------------------------------



omicronpersei8imagemagick.org wrote:
> We suspect the problem is related to vectors that are
very close to each
> other or near-duplicates that are not being culled
properly to avoid
> mathematical precision problems on a finite precision
CPU.  However, we
> need to reproduce the problem before we can investigate
further.  If you
> can come up with a test case you can send us we'll come
up with a soluton.
> 
> 

--- draw.c.orig	2006-10-23 23:02:22.000000000 +0200
+++ draw.c	2006-11-29 17:08:48.937500000 +0100
 -5223,6
+5223,8 
     if ((fabs(dx.p) >= MagickEpsilon) || (fabs(dy.p)
>= MagickEpsilon))
       break;
   }
+  if (n >= number_vertices)
+     n = number_vertices - 1;
   slope.p=0.0;
   inverse_slope.p=0.0;
   if (fabs(dx.p) <= MagickEpsilon)
_______________________________________________
Magick-bugs mailing list
Magick-bugsimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-
bugs
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )