fixed writing huge matrices (ticket #1439)
authorVadim Pisarevsky <no@email>
Wed, 28 Mar 2012 09:57:31 +0000 (09:57 +0000)
committerVadim Pisarevsky <no@email>
Wed, 28 Mar 2012 09:57:31 +0000 (09:57 +0000)
modules/core/src/persistence.cpp
modules/core/test/test_io.cpp

index 0746aaf..e829580 100644 (file)
@@ -3410,7 +3410,7 @@ icvWriteMat( CvFileStorage* fs, const char* name,
         }
 
         for( y = 0; y < size.height; y++ )
-            cvWriteRawData( fs, mat->data.ptr + y*mat->step, size.width, dt );
+            cvWriteRawData( fs, mat->data.ptr + (size_t)y*mat->step, size.width, dt );
     }
     cvEndWriteStruct( fs );
     cvEndWriteStruct( fs );
index 45390e5..40aab53 100644 (file)
@@ -376,3 +376,32 @@ protected:
 };
 
 TEST(Core_InputOutput, write_read_consistency) { Core_IOTest test; test.safe_run(); }
+
+/*class CV_BigMatrixIOTest : public cvtest::BaseTest
+{
+public:
+    CV_BigMatrixIOTest() {}
+    ~CV_BigMatrixIOTest() {}   
+protected:
+    void run(int)
+    {
+        try
+        {
+            RNG& rng = theRNG();
+            int N = 1000, M = 1200000;
+            Mat mat(M, N, CV_32F);
+            rng.fill(mat, RNG::UNIFORM, 0, 1);
+            FileStorage fs("test.xml", FileStorage::WRITE);
+            fs << "mat" << mat;
+            fs.release();
+        }
+        catch(...)
+        {
+            ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
+        }
+    }
+};
+
+TEST(Core_InputOutput, huge) { CV_BigMatrixIOTest test; test.safe_run(); }
+*/
+