[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/4] cirrus: handle negative pitch in cirrus_invalida
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 1/4] cirrus: handle negative pitch in cirrus_invalidate_region() |
Date: |
Thu, 2 Feb 2017 16:05:04 +0100 |
From: Wolfgang Bumiller <address@hidden>
cirrus_invalidate_region() calls memory_region_set_dirty()
on a per-line basis, always ranging from off_begin to
off_begin+bytesperline. With a negative pitch off_begin
marks the top most used address and thus we need to do an
initial shift backwards by a line for negative pitches of
backward blits, otherwise the first iteration covers the
line going from the start offset forwards instead of
backwards.
Additionally since the start address is inclusive, if we
shift by a full `bytesperline` we move to the first address
*not* included in the blit, so we only shift by one less
than bytesperline.
Signed-off-by: Wolfgang Bumiller <address@hidden>
Message-id: address@hidden
[ kraxel: codestyle fixes ]
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/display/cirrus_vga.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 379910d..0f05e45 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -661,9 +661,14 @@ static void cirrus_invalidate_region(CirrusVGAState * s,
int off_begin,
int off_cur;
int off_cur_end;
+ if (off_pitch < 0) {
+ off_begin -= bytesperline - 1;
+ }
+
for (y = 0; y < lines; y++) {
off_cur = off_begin;
off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
+ assert(off_cur_end >= off_cur);
memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
off_begin += off_pitch;
}
--
1.8.3.1
- [Qemu-devel] [PULL 0/4] cirrus: multiple bugfixes, including CVE-2017-2615 fix., Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 4/4] cirrus: fix oob access issue (CVE-2017-2615), Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 1/4] cirrus: handle negative pitch in cirrus_invalidate_region(), Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 3/4] cirrus: fix blit address mask handling, Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 2/4] cirrus: allow zero source pitch in pattern fill rops, Gerd Hoffmann, 2017/02/02
- Re: [Qemu-devel] [PULL 0/4] cirrus: multiple bugfixes, including CVE-2017-2615 fix., Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 0/4] cirrus: multiple bugfixes, including CVE-2017-2615 fix., Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 4/4] cirrus: fix oob access issue (CVE-2017-2615), Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 1/4] cirrus: handle negative pitch in cirrus_invalidate_region(),
Gerd Hoffmann <=
- [Qemu-devel] [PULL 2/4] cirrus: allow zero source pitch in pattern fill rops, Gerd Hoffmann, 2017/02/02
- [Qemu-devel] [PULL 3/4] cirrus: fix blit address mask handling, Gerd Hoffmann, 2017/02/02
- Re: [Qemu-devel] [PULL 0/4] cirrus: multiple bugfixes, including CVE-2017-2615 fix., Peter Maydell, 2017/02/03