Passing PIL an invalid PPM file makes it throw an IOError.

Signed-off-by: Michael Goldish <[email protected]>
---
 client/tests/kvm/kvm_preprocessing.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py 
b/client/tests/kvm/kvm_preprocessing.py
index 729e1d4..8809f31 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -273,9 +273,10 @@ def postprocess(test, params, env):
                       " files to PNG format...")
         try:
             for f in glob.glob(os.path.join(test.debugdir, "*.ppm")):
-                new_path = f.replace(".ppm", ".png")
-                image = PIL.Image.open(f)
-                image.save(new_path, format = 'PNG')
+                if ppm_utils.image_verify_ppm_file(f):
+                    new_path = f.replace(".ppm", ".png")
+                    image = PIL.Image.open(f)
+                    image.save(new_path, format='PNG')
         except NameError:
             pass
 
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to