[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for-2.9 1/7] fix :cirrus_vga fix OOB read case qemu S
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL for-2.9 1/7] fix :cirrus_vga fix OOB read case qemu Segmentation fault |
Date: |
Thu, 16 Mar 2017 10:30:36 +0100 |
From: hangaohuai <address@hidden>
check the validity of parameters in cirrus_bitblt_rop_fwd_transp_xxx
and cirrus_bitblt_rop_fwd_xxx to avoid the OOB read which causes qemu
Segmentation fault.
After the fix, we will touch the assert in
cirrus_invalidate_region:
assert(off_cur_end >= off_cur);
Signed-off-by: fangying <address@hidden>
Signed-off-by: hangaohuai <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/display/cirrus_vga_rop.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/display/cirrus_vga_rop.h b/hw/display/cirrus_vga_rop.h
index 0925a00..b7447f8 100644
--- a/hw/display/cirrus_vga_rop.h
+++ b/hw/display/cirrus_vga_rop.h
@@ -97,6 +97,11 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_,
ROP_NAME),_8)(CirrusVGAState *s,
uint8_t p;
dstpitch -= bltwidth;
srcpitch -= bltwidth;
+
+ if (bltheight > 1 && (dstpitch < 0 || srcpitch < 0)) {
+ return;
+ }
+
for (y = 0; y < bltheight; y++) {
for (x = 0; x < bltwidth; x++) {
p = *dst;
@@ -143,6 +148,11 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_,
ROP_NAME),_16)(CirrusVGAState *s,
uint8_t p1, p2;
dstpitch -= bltwidth;
srcpitch -= bltwidth;
+
+ if (bltheight > 1 && (dstpitch < 0 || srcpitch < 0)) {
+ return;
+ }
+
for (y = 0; y < bltheight; y++) {
for (x = 0; x < bltwidth; x+=2) {
p1 = *dst;
--
1.8.3.1
- [Qemu-devel] [PULL for-2.9 0/7] cirrus: more blitter security fixes., Gerd Hoffmann, 2017/03/16
- [Qemu-devel] [PULL for-2.9 1/7] fix :cirrus_vga fix OOB read case qemu Segmentation fault,
Gerd Hoffmann <=
- [Qemu-devel] [PULL for-2.9 3/7] cirrus: switch to 4 MB video memory by default, Gerd Hoffmann, 2017/03/16
- [Qemu-devel] [PULL for-2.9 4/7] cirrus: add option to disable blitter, Gerd Hoffmann, 2017/03/16
- [Qemu-devel] [PULL for-2.9 6/7] cirrus: stop passing around dst pointers in the blitter, Gerd Hoffmann, 2017/03/16
- [Qemu-devel] [PULL for-2.9 5/7] cirrus: fix cirrus_invalidate_region, Gerd Hoffmann, 2017/03/16
- [Qemu-devel] [PULL for-2.9 7/7] cirrus: stop passing around src pointers in the blitter, Gerd Hoffmann, 2017/03/16
- [Qemu-devel] [PULL for-2.9 2/7] cirrus/vnc: zap bitblit support from console code., Gerd Hoffmann, 2017/03/16
- Re: [Qemu-devel] [PULL for-2.9 0/7] cirrus: more blitter security fixes., Peter Maydell, 2017/03/16