]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Fri, 12 May 2017 16:38:37 +0000 (12:38 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 12 May 2017 16:38:37 +0000 (12:38 -0400)
MagickCore/vision.c

index 630cd4ea98ed4b2f9a9c19870ee83a7cc3c16f11..f8e1c115267def195022571b28827a91a8aec57a 100644 (file)
@@ -280,14 +280,14 @@ MagickExport Image *ConnectedComponentsImage(const Image *image,
           Is neighbor an authentic pixel and a different color than the pixel?
         */
         GetPixelInfoPixel(image,p,&pixel);
-        neighbor_offset=dy*(GetPixelChannels(image)*image->columns)+dx*
-          GetPixelChannels(image);
         if (((x+dx) < 0) || ((x+dx) >= (ssize_t) image->columns) ||
             ((y+dy) < 0) || ((y+dy) >= (ssize_t) image->rows))
           {
             p+=GetPixelChannels(image);
             continue;
           }
+        neighbor_offset=dy*(GetPixelChannels(image)*image->columns)+dx*
+          GetPixelChannels(image);
         GetPixelInfoPixel(image,p+neighbor_offset,&target);
         if (IsFuzzyEquivalencePixelInfo(&pixel,&target) == MagickFalse)
           {