Author: post
Date: 2010-10-28 22:56:51 +0200 (Thu, 28 Oct 2010)
New Revision: 286

Modified:
   RawSpeed/Camera.cpp
   RawSpeed/RawImage.cpp
Log:
Add two checks for negative crop offsets.

Modified: RawSpeed/Camera.cpp
===================================================================
--- RawSpeed/Camera.cpp 2010-10-28 20:47:51 UTC (rev 285)
+++ RawSpeed/Camera.cpp 2010-10-28 20:56:51 UTC (rev 286)
@@ -118,6 +118,11 @@
     cropPos.x = getAttributeAsInt(cur, cur->name, "x");
     cropPos.y = getAttributeAsInt(cur, cur->name, "y");
 
+    if (cropPos.x < 0)
+      ThrowCME("Negative X axis crop specified in camera %s %s", make.c_str(), 
model.c_str());
+    if (cropPos.y < 0)
+      ThrowCME("Negative Y axis crop specified in camera %s %s", make.c_str(), 
model.c_str());
+
     cropSize.x = getAttributeAsInt(cur, cur->name, "width");
     cropSize.y = getAttributeAsInt(cur, cur->name, "height");
     return;

Modified: RawSpeed/RawImage.cpp
===================================================================
--- RawSpeed/RawImage.cpp       2010-10-28 20:47:51 UTC (rev 285)
+++ RawSpeed/RawImage.cpp       2010-10-28 20:56:51 UTC (rev 286)
@@ -111,6 +111,10 @@
     printf("WARNING: RawImageData::subFrame - Attempted to create new subframe 
larger than original size. Crop skipped.\n");
     return;
   }
+  if (offset.x < 0 || offset.y < 0) {
+    printf("WARNING: RawImageData::subFrame - Negative crop offset. Crop 
skipped.\n");
+    return;
+  }
 
   mOffset += offset;
   dim = new_size;


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

Reply via email to