From patchwork Wed Sep 9 18:12:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 46438 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n89IFuo1019221 for ; Wed, 9 Sep 2009 18:15:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753999AbZIISPu (ORCPT ); Wed, 9 Sep 2009 14:15:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753986AbZIISPt (ORCPT ); Wed, 9 Sep 2009 14:15:49 -0400 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 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFoYh019951; Wed, 9 Sep 2009 14:15:51 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFos2015432; Wed, 9 Sep 2009 14:15:50 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFNFe012008; Wed, 9 Sep 2009 14:15:48 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: 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> In-Reply-To: <1252519932-30733-18-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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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