Author: post
Date: 2010-04-25 14:15:42 +0200 (Sun, 25 Apr 2010)
New Revision: 223

Modified:
   RawSpeed/RawDecoder.cpp
Log:
Make sure there is at least one line of data available, when reading 
uncompressed RAW.

Modified: RawSpeed/RawDecoder.cpp
===================================================================
--- RawSpeed/RawDecoder.cpp     2010-04-24 23:14:31 UTC (rev 222)
+++ RawSpeed/RawDecoder.cpp     2010-04-25 12:15:42 UTC (rev 223)
@@ -43,7 +43,10 @@
   guint cpp = mRaw->getCpp();
 
   if (input.getRemainSize() < (inputPitch*h)) {
-    h = input.getRemainSize() / inputPitch - 1;
+    if ((int)input.getRemainSize() > inputPitch)
+      h = input.getRemainSize() / inputPitch - 1;
+    else
+      ThrowRDE("readUncompressedRaw: Not enough data to decode a single line. 
Image file truncated.");
   }
   if (bitPerPixel > 16)
     ThrowRDE("readUncompressedRaw: Unsupported bit depth");


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to