Author: jleroux
Date: Mon Feb 23 17:56:38 2009
New Revision: 747091
URL:
http://svn.apache.org/viewvc?rev=747091&view=revLog:
A bit more secure image uploading
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/image/ImageTransform.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/image/ImageTransform.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/image/ImageTransform.java?rev=747091&r1=747090&r2=747091&view=diff==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/image/ImageTransform.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/image/ImageTransform.java Mon Feb 23 17:56:38 2009
@@ -362,8 +362,13 @@
result.put("errorMessage", errMsg);
return result;
}
-
- bufNewImg = new BufferedImage( (int) (imgWidth * scaleFactor), (int) (imgHeight * scaleFactor), bufImg.getType());
+ if (BufferedImage.TYPE_CUSTOM == bufImg.getType()) {
+ String errMsg = "Unknown BufferedImage type ";
+ Debug.logError(errMsg, module);
+ result.put("errorMessage", errMsg);
+ return result;
+ }
+ bufNewImg = new BufferedImage( (int) (imgWidth * scaleFactor), (int) (imgHeight * scaleFactor), bufImg.getType());
result.put("responseMessage", "success");
result.put("bufferedImage", bufNewImg);