svn commit: r747091 - /ofbiz/trunk/applications/product/src/org/ofbiz/image/ImageTransform.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r747091 - /ofbiz/trunk/applications/product/src/org/ofbiz/image/ImageTransform.java

jleroux@apache.org
Author: jleroux
Date: Mon Feb 23 17:56:38 2009
New Revision: 747091

URL: http://svn.apache.org/viewvc?rev=747091&view=rev
Log:
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);