Hi,

I'm using the OpenEXR 2.0.0 version downloaded from the website. The compilation takes place on a Win7 x64 system with VS2010. (I updated the project files.) In release mode everything works fine. In debug mode, I'm experiencing four failures in the IlmImfTest suite: testAttributes, testDeepScanLineMultipleRead, testCompositeDeepScanLine, testMultiPartSharedAttributes.
Each test fails right at the start.

testAttributes: (String subscript out of range)
I traced this error back to the attempt to read an empty string. It's about reading the second element of the header attribute a15 ("who can spin", "", "straw into", "gold"). The problem is in function "StringVectorAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)". In this test, the input buffer is resized to a length of zero. Upon retrieving a pointer to the first element, a debug error is raised from the stl, which is correct behavior. In order to avoid this problem, I simply skip the reading call when there are no characters to read (see attached patch file "ImfStringVectorAttribute.cpp.patch").

testDeepScanLineMultipleRead: (Vector subscript out of range)
This time it is the test itself that causes the error. The function "static void read_file(const char * filename) [testDeepScanLineMultipleRead.cpp]" can't handle the case when it should read row zero. This scanline does not contain any samples. Therefore, one can't set any pointer to these samples. I adjusted the for-loop, which updates sample_pointers, in order to avoid this glitch. (see attached path file "testDeepScanLineMultipleRead.cpp").

testCompositeDeepScanLine: (Vector subscript out of range)
This error is located at "void CompositeDeepScanLine::readPixels(int start, int end) [ImfCompositeDeepScanLine.cpp:536]". The attempt to read the last sample fails. The calculated index is by one too big. I don't understand this part of the library very well, so I don't try to present a workaround.

testMultiPartSharedAttributes: (Vector subscript out of range)
This error occurs in the testHeaders() subtest. The function "testMultiPartOutputFileForExpectedFailure(const vector<Header> & headers, const string & failMessage="")" is given an empty vector. The attempt to get the first element of the empty vector fails. (The test for an expected error kills itself. :-D) One can easily catch this case and use a NULL pointer as parameter (see attached path file "testMultiPartSharedAttributes.cpp.patch").

I hope, I could help to kill some bugs. Please correct me, if these fixes don't do what they are intended to do.

Best regards
Michael


-----
visit us at

Digital Signage Europe Expo 2013 / June 12-13 / The Station-Gleisdreieck, 
Berlin, Germany / booth F.10

infoCOMM13 / June 12-14 / Orange County Convention Center, Orlando, Florida / 
booth 5453

www.hhi.fraunhofer.de/events
Index: ImfStringVectorAttribute.cpp
===================================================================
--- ImfStringVectorAttribute.cpp        (revision 51)
+++ ImfStringVectorAttribute.cpp        (working copy)
@@ -81,13 +81,15 @@
     {   
        int strSize;
        Xdr::read <StreamIO> (is, strSize);
-       read += Xdr::size<int>();       
+       read += Xdr::size<int>();
 
        std::string str;
        str.resize (strSize);
-  
+       if(0 != strSize)
+       {
        Xdr::read<StreamIO> (is, &str[0], strSize);
        read += strSize;
+       }
 
        _value.push_back (str);
     }
Index: testMultiPartSharedAttributes.cpp
===================================================================
--- testMultiPartSharedAttributes.cpp   (revision 51)
+++ testMultiPartSharedAttributes.cpp   (working copy)
@@ -151,7 +151,13 @@
     try
     {
         remove(filename);
-        MultiPartOutputFile file(filename, &headers[0],headers.size());
+        if(true == headers.empty())
+        {
+          MultiPartOutputFile file(filename, NULL, headers.size());
+        } else {
+          MultiPartOutputFile file(filename, &headers[0], headers.size());
+        }
+        
         cerr << "ERROR -- " << failMessage << endl;
         assert (false);
     }
Index: testDeepScanLineMultipleRead.cpp
===================================================================
--- testDeepScanLineMultipleRead.cpp    (revision 51)
+++ testDeepScanLineMultipleRead.cpp    (working copy)
@@ -78,12 +78,12 @@
     int height=48;
     
     //
-    // create a deep output file of widthxheight, where each pixel has 'y' 
samples,
+    // create a deep output file of width x height, where each pixel has 'y' 
samples,
     // each with value 'x'
     //
     
-    Header header( width,height);
-    header.channels().insert("Z", Channel(FLOAT));      
+    Header header(width, height);
+    header.channels().insert("Z", Channel(FLOAT));
     header.compression()=ZIPS_COMPRESSION;
     header.setType(DEEPSCANLINE);
         
@@ -107,7 +107,7 @@
         //
         // ensure each scanline contains a different number of samples,
         // with different values. We don't care that each sample has the same
-        // value, or that each pixel on the scanline is identical
+        // value, or that each pixel on the scanline is identical.
         //
         sample_count = y;
         sample = y+100.0;
@@ -160,7 +160,7 @@
             
             if( samplecounts[i]!= row)
             {
-              cout << i << ", " << row << " error, sample counts hould be "
+              cout << i << ", " << row << " error, sample counts should be "
               << row  << ", is " << samplecounts[i]
               << endl << flush;
             }
@@ -175,7 +175,7 @@
         // set pointers to point to the correct place
         //
         int total=0;
-        for(int i=0;i<width;i++)
+        for(int i=0;i<width && false==samples.empty();i++)
         {
             sample_pointers[i] = &samples[total];
             total+=samplecounts[i];
@@ -195,7 +195,7 @@
         {
            if(samples[i]!=row+100.f)
            {
-               cout << " sample " << i << " on row " << row << " error, shuold 
be " 
+               cout << " sample " << i << " on row " << row << " error, should 
be " 
                     << 100.f+row << " got " << samples[i] << endl;
                cout << flush;
            }
_______________________________________________
Openexr-devel mailing list
Openexr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/openexr-devel

Reply via email to