Author: post
Date: 2010-04-25 14:37:10 +0200 (Sun, 25 Apr 2010)
New Revision: 227

Modified:
   RawSpeed/RawDecoder.cpp
Log:
Check if there is enough image available for a single line in dedicated 12 bit 
decoder.

Modified: RawSpeed/RawDecoder.cpp
===================================================================
--- RawSpeed/RawDecoder.cpp     2010-04-25 12:36:06 UTC (rev 226)
+++ RawSpeed/RawDecoder.cpp     2010-04-25 12:37:10 UTC (rev 227)
@@ -102,8 +102,11 @@
   guchar* data = mRaw->getData();
   guint pitch = mRaw->pitch;
   const guchar *in = input.getData();
-  if (input.getRemainSize() < (w*h*3 / 2)) {
-    h = input.getRemainSize() / (w * 3 / 2) - 1;
+  if (input.getRemainSize() < (w*h)) {
+    if ((int)input.getRemainSize() > w)
+      h = input.getRemainSize() / w - 1;
+    else
+      ThrowIOE("readUncompressedRaw: Not enough data to decode a single line. 
Image file truncated.");
   }
   for (guint y = 0; y < h; y++) {
     gushort* dest = (gushort*) & data[y*pitch];


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

Reply via email to