From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] cirrus_vga: fix off-by-one in blit_region_is_unsafe
Date: Tue, 9 Feb 2016 11:59:17 +0100 [thread overview]
Message-ID: <1455015557-15106-3-git-send-email-pbonzini@redhat.com> (raw)
The "max" value is being compared with >=, but addr + width points to
the first byte that will _not_ be copied. Subtract one like it is
already done above for the height.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/display/cirrus_vga.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index b6ce1c8..e7939d2 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -275,14 +275,14 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
int64_t min = addr
+ ((int64_t)s->cirrus_blt_height-1) * pitch;
int32_t max = addr
- + s->cirrus_blt_width;
+ + s->cirrus_blt_width-1;
if (min < 0 || max >= s->vga.vram_size) {
return true;
}
} else {
int64_t max = addr
+ ((int64_t)s->cirrus_blt_height-1) * pitch
- + s->cirrus_blt_width;
+ + s->cirrus_blt_width-1;
if (max >= s->vga.vram_size) {
return true;
}
--
2.5.0
next reply other threads:[~2016-02-09 10:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 10:59 Paolo Bonzini [this message]
2016-02-09 19:08 ` [Qemu-devel] [PATCH] cirrus_vga: fix off-by-one in blit_region_is_unsafe Laszlo Ersek
2016-02-10 12:32 ` Paolo Bonzini
2016-02-10 14:55 ` Laszlo Ersek
2016-02-10 15:29 ` Paolo Bonzini
2016-02-10 15:54 ` Laszlo Ersek
2016-02-10 16:15 ` Paolo Bonzini
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=1455015557-15106-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).