exr uninitialized memory

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
cyril
Posts: 2
Joined: 2013-04-29T03:28:59-07:00
Authentication code: 6789

exr uninitialized memory

Post by cyril »

Hi,
I came along an uninitialized memory issue in exr.c. Basically I use exr files that have a data window different than the display window, for instance:
  • exrheader myfile.exr:
    ...
    dataWindow (type box2i): (493 162) - (1541 797)
    displayWindow (type box2i): (0 0) - (1919 1079)
    ...
When image magick reads the file it allocates a buffer of the width of the image. The exr library fills only the pixels in the data window, leaving the other pixel uninitialized.
Here is a proposed patch, that could give you some hints of where the issue is located:

Code: Select all

--- tmp/ImageMagick-6.8.5-3/coders/exr.c 
+++ Installs/ImageMagick-6.8.4-10/coders/exr.c 
@@ -218,6 +218,7 @@
     }
   for (y=0; y < (ssize_t) image->rows; y++)
   {
+    bzero(scanline, image->columns*sizeof(*scanline));
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
     if (q == (PixelPacket *) NULL)
       break;
@@ -427,6 +428,7 @@
       (void) ImfCloseOutputFile(file);
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     }
+  bzero(scanline, image->columns*sizeof(*scanline));
   for (y=0; y < (ssize_t) image->rows; y++)
   {
     p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
Hope it helps,

C
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: exr uninitialized memory

Post by magick »

Thanks for the patch, we'll get it into ImageMagick 6.8.5-4 Beta by sometime tomorrow.
cyril
Posts: 2
Joined: 2013-04-29T03:28:59-07:00
Authentication code: 6789

Re: exr uninitialized memory

Post by cyril »

Thanks !
I am looking forward to this new version.

Cyril
Post Reply