All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Uri Lublin <uril@redhat.com>
Cc: Ryan Harper <ryanh@us.ibm.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: [PATCH] kvm-autotest: stepeditor: clear image if width, height, or data are invalid
Date: Fri, 03 Apr 2009 18:43:14 -0300	[thread overview]
Message-ID: <1238794446-sup-7467@blackpad> (raw)
In-Reply-To: <1238790500-sup-8351@blackpad>


This patch fixes the following issue:

Excerpts from Eduardo Habkost's message of Fri Apr 03 17:37:56 -0300 2009:
> Excerpts from Ryan Harper's message of Wed Apr 01 12:55:58 -0300 2009:
> > Wondering if anyone else using kvm-autotest stepmaker has ever seen this
> > error:
> > 
> > Traceback (most recent call last):
> >   File
> > "/home/rharper/work/git/build/kvm-autotest/client/tests/kvm_runtest_2/stepmaker.
> > py", line 146, in update
> >     self.set_image_from_file(self.screendump_filename)
> >   File
> > "/home/rharper/work/git/build/kvm-autotest/client/tests/kvm_runtest_2/stepeditor
> > .py", line 499, in set_image_from_file
> >     self.set_image(w, h, data)
> >   File
> > "/home/rharper/work/git/build/kvm-autotest/client/tests/kvm_runtest_2/stepeditor
> > .py", line 485, in set_image
> >     w, h, w*3))
> > MemoryError
> 
> I've seen this error twice today, while trying to create a step file to
> install a Windows 2008 R2 64-bit guest (the Win2008-64 step file
> available on the git repository doesn't work for me). This happened when
> the guest was being rebooted by the windows installer. The contents of
> the screen dump file are this:
> 
> $ cat
> /home/ehabkost/autotest/kvm-autotest/client/results/default/kvm_runtest_2.Win200
> 8.64.install/debug/scrdump.ppm
> P6
> 0 0
> 255
> $ 
> 
> And the 0x0 pixmap really makes gdk panic:
> 
> >>> (w, h, data) =  ppm_utils.image_read_from_ppm_file('/home/ehabkost/autotest/kvm-autotest/client/results/default/kvm_runtest_2.Win2008.64.install/debug/scrdump.ppm')
> >>> w,h,data
> (0, 0, '')
> >>> gtk.gdk.pixbuf_new_from_data(data, gtk.gdk.COLORSPACE_RGB, False, 8,  w, h, w*3)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> MemoryError
> >>> 


Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 client/tests/kvm_runtest_2/stepeditor.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/client/tests/kvm_runtest_2/stepeditor.py b/client/tests/kvm_runtest_2/stepeditor.py
index caaf47b..383834b 100755
--- a/client/tests/kvm_runtest_2/stepeditor.py
+++ b/client/tests/kvm_runtest_2/stepeditor.py
@@ -488,14 +488,18 @@ Utilities
         vscrollbar = self.scrolledwindow.get_vscrollbar()
         vscrollbar.set_range(0, h)
 
+    def clear_image(self):
+        self.image.clear()
+        self.image_width = 0
+        self.image_height = 0
+        self.image_data = ""
+        
     def set_image_from_file(self, filename):
         if not filename or not os.path.exists(filename):
-            self.image.clear()
-            self.image_width = 0
-            self.image_height = 0
-            self.image_data = ""
-            return
+            return self.clear_image()
         (w, h, data) = ppm_utils.image_read_from_ppm_file(filename)
+        if w <= 0 or h <= 0 or not data:
+            return self.clear_image()
         self.set_image(w, h, data)
 
     def get_step_lines(self, output_dir=None, current_step=None):

-- 
1.5.5.6
-- 
Eduardo

  reply	other threads:[~2009-04-03 21:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-01 15:55 kvm-autotest: weird memory error during stepmaker test Ryan Harper
2009-04-03 20:37 ` Eduardo Habkost
2009-04-03 21:43   ` Eduardo Habkost [this message]
2009-04-05 12:31     ` [PATCH] kvm-autotest: stepeditor: clear image if width, height, or data are invalid Avi Kivity
2009-04-05 17:33       ` Eduardo Habkost
2009-04-05 17:33       ` Uri Lublin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1238794446-sup-7467@blackpad \
    --to=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=ryanh@us.ibm.com \
    --cc=uril@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.