From: Michael Goldish Subject: [PATCH 19/19] KVM test: kvm_preprocessing.py: verify PPM file validity before passing to PIL Date: Wed, 9 Sep 2009 21:12:12 +0300 Message-ID: <1252519932-30733-19-git-send-email-mgoldish@redhat.com> References: <1252519932-30733-1-git-send-email-mgoldish@redhat.com> <1252519932-30733-2-git-send-email-mgoldish@redhat.com> <1252519932-30733-3-git-send-email-mgoldish@redhat.com> <1252519932-30733-4-git-send-email-mgoldish@redhat.com> <1252519932-30733-5-git-send-email-mgoldish@redhat.com> <1252519932-30733-6-git-send-email-mgoldish@redhat.com> <1252519932-30733-7-git-send-email-mgoldish@redhat.com> <1252519932-30733-8-git-send-email-mgoldish@redhat.com> <1252519932-30733-9-git-send-email-mgoldish@redhat.com> <1252519932-30733-10-git-send-email-mgoldish@redhat.com> <1252519932-30733-11-git-send-email-mgoldish@redhat.com> <1252519932-30733-12-git-send-email-mgoldish@redhat.com> <1252519932-30733-13-git-send-email-mgoldish@redhat.com> <1252519932-30733-14-git-send-email-mgoldish@redhat.com> <1252519932-30733-15-git-send-email-mgoldish@redhat.com> <1252519932-30733-16-git-send-email-mgoldish@redhat.com> <1252519932-30733-17-git-send-email-mgoldish@redhat.com> <1252519932-30733-18-git-send-email-mgoldish@redhat.com> Cc: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:18227 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753990AbZIISPr (ORCPT ); Wed, 9 Sep 2009 14:15:47 -0400 In-Reply-To: <1252519932-30733-18-git-send-email-mgoldish@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Passing PIL an invalid PPM file makes it throw an IOError. Signed-off-by: Michael Goldish --- 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