qxl-render: add more sanity checks
PATCH v2 1/1 qxl-render: add more sanity checks
Damn, the dirty rectangle values are signed integers. So the checks added by commit 788fbf042fc6d5aaeab56757e6dad622ac5f0c21 are not good enouth, we also have to make sure they are not negative.
[ Note: There must be something broken in spice-server so we get
negative values in the first place. Bug opened:
https://bugzilla.redhat.com/show_bug.cgi?id=1135372 ]
--- hw/display/qxl-render.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/display/qxl-render.c +3 -1
@@ -138,7 +138,9 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)if (qemu_spice_rect_is_empty (qxl->dirty+i)) {break ; } -if (qxl->dirty[i].left > qxl->dirty[i].right || +if (qxl->dirty[i].left <0 || + qxl->dirty[i].top <0 || + qxl->dirty[i].left > qxl->dirty[i].right || qxl->dirty[i].top > qxl->dirty[i].bottom || qxl->dirty[i].right > qxl->guest_primary.surface.width || qxl->dirty[i].bottom > qxl->guest_primary.surface.height) {
Signature · 1 line
1.8.3.1
Quoted 18 lines · * Gerd Hoffmann ([email protected]) wrote:
Damn, the dirty rectangle values are signed integers. So the checks added by commit
788fbf042fc6d5aaeab56757e6dad622ac5f0c21are not good enouth, we also have to make sure they are not negative.[ Note: There must be something broken in spice-server so we get
negative values in the first place. Bug opened:
https://bugzilla.redhat.com/show_bug.cgi?id=1135372 ]Signed-off-by Gerd Hoffmann <[email protected]>--- hw/display/qxl-render.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)hw/display/qxl-render.c +0
-0
hw/display/qxl-render.c static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl) · line 146
Quoted 10 lines
hw/display/qxl-render.c +3
-1@@ -138,7 +138,9 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)if (qemu_spice_rect_is_empty (qxl->dirty+i)) {break ; } -if (qxl->dirty[i].left > qxl->dirty[i].right || +if (qxl->dirty[i].left <0 || + qxl->dirty[i].top <0 || + qxl->dirty[i].left > qxl->dirty[i].right || qxl->dirty[i].top > qxl->dirty[i].bottom || qxl->dirty[i].right > qxl->guest_primary.surface.width || qxl->dirty[i].bottom > qxl->guest_primary.surface.height) {
Should this go for stable as well?
(I was worried for a sec about what happens if right=width or bottom=height; but looking at the code below it I think it's a dirty from left..(right-1) so we're OK?)
Dave
Quoted 4 lines
Signature · 1 line
1.8.3.1
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Hi,
Quoted 3 lines
Reviewed-by Dr. David Alan Gilbert <[email protected]>Should this go for stable as well?
Yep. Added cc qemu-stable.
Quoted 3 lines
(I was worried for a sec about what happens if right=width or bottom=height; but looking at the code below it I think it's a dirty from left..(right-1) so we're OK?)
Correct.
cheers,
Gerd
Quoted 3 lines · Gerd Hoffmann
Damn, the dirty rectangle values are signed integers. So the checks added by commit
788fbf042fc6d5aaeab56757e6dad622ac5f0c21are not good enouth, we also have to make sure they are not negative.
s/enouth/enough/
Quoted 10 lines
[ Note: There must be something broken in spice-server so we get
negative values in the first place. Bug opened:
https://bugzilla.redhat.com/show_bug.cgi?id=1135372 ]Signed-off-by Gerd Hoffmann <[email protected]>--- hw/display/qxl-render.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 1 line · Eric Blake
s/enouth/enough/
fixed, thanks,
Gerd