Fixes 20220408 patches
The following changes since commit 95a3fcc7487e5bef262e1f937ed8636986764c4e:
Update version for v7.0.0-rc3 release (2022-04-06 21:26:13 +0100)
are available in the Git repository at:
git://git.kraxel.org/qemu tags/fixes-20220408-pull-request
for you to fetch changes up to fa892e9abb728e76afcf27323ab29c57fb0fe7aa:
ui/cursor: fix integer overflow in cursor_alloc (CVE-2021-4206) (2022-04-07 12:30:54 +0200)
----------------------------------------------------------------
two cursor/qxl related security fixes.
----------------------------------------------------------------
Mauro Matteo Cascella (2):
display/qxl-render: fix race condition in qxl_cursor (CVE-2021-4207) ui/cursor: fix integer overflow in cursor_alloc (CVE-2021-4206)
hw/display/qxl-render.c | 9 ++++++++- hw/display/vmware_vga.c | 2 ++ ui/cursor.c | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
2.35.1
[PULL 1/2] display/qxl-render: fix race condition in qxl_cursor (CVE-2021-4207)
From: Mauro Matteo Cascella <[email protected]>
Avoid fetching 'width' and 'height' a second time to prevent possible race condition. Refer to security advisory
https://starlabs.sg/advisories/22-4207/ for more information.
Message-Id: <[email protected]>
--- hw/display/qxl-render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/qxl-render.c +1 -1
@@ -266,7 +266,7 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor, }break ;case SPICE_CURSOR_TYPE_ALPHA : - size =sizeof (uint32_t ) * cursor->header.width * cursor->header.height; + size =sizeof (uint32_t ) * c->width * c->height;qxl_unpack_chunks (c->data, size, qxl, &cursor->chunk, group_id);if (qxl->debug >2 ) {cursor_print_ascii_art (c,"qxl/alpha" );
Signature · 1 line
2.35.1
[PULL 2/2] ui/cursor: fix integer overflow in cursor_alloc (CVE-2021-4206)
In reply to Gerd HoffmannFrom: Mauro Matteo Cascella <[email protected]>
Prevent potential integer overflow by limiting 'width' and 'height' to 512x512. Also change 'datasize' type to size_t. Refer to security advisory https://starlabs.sg/advisories/22-4206/ for more information.
Message-Id: <[email protected]>
--- hw/display/qxl-render.c | 7 +++++++ hw/display/vmware_vga.c | 2 ++ ui/cursor.c | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-)
hw/display/qxl-render.c +7 -0
@@ -247,6 +247,13 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,size_t size; c =cursor_alloc (cursor->header.width, cursor->header.height); + +if (!c) { +qxl_set_guest_bug (qxl,"%s: cursor %ux%u alloc error" , __func__, + cursor->header.width, cursor->header.height); + goto fail; + } + c->hot_x = cursor->header.hot_spot_x; c->hot_y = cursor->header.hot_spot_y;switch (cursor->header.type) {
hw/display/vmware_vga.c +2 -0
@@ -515,6 +515,8 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,int i, pixels; qc =cursor_alloc (c->width, c->height); +assert (qc !=NULL ); + qc->hot_x = c->hot_x; qc->hot_y = c->hot_y;switch (c->bpp) {
ui/cursor.c +7 -1
@@ -46,6 +46,8 @@ static QEMUCursor *cursor_parse_xpm(const char *xpm[])/* parse pixel data */ c =cursor_alloc (width, height); +assert (c !=NULL ); +for (pixel =0 , y =0 ; y < height; y++, line++) {for (x =0 ; x < height; x++, pixel++) { idx = xpm[line][x];
@@ -91,7 +93,11 @@ QEMUCursor *cursor_builtin_left_ptr(void)QEMUCursor *cursor_alloc (int width,int height) {QEMUCursor *c; -int datasize = width * height *sizeof (uint32_t ); +size_t datasize = width * height *sizeof (uint32_t ); + +if (width >512 || height >512 ) { +return NULL ; + } c =g_malloc0 (sizeof (QEMUCursor) + datasize); c->width = width;
Signature · 1 line
2.35.1
Peter Maydell
AppliedQuoted 7 lines · Gerd Hoffmann
The following changes since commit
95a3fcc7487e5bef262e1f937ed8636986764c4e:Update version for v7.0.0-rc3 release (2022-04-06 21:26:13 +0100)
are available in the Git repository at:
Quoted 9 lines
git://git.kraxel.org/qemutags/fixes-20220408-pull-requestfor you to fetch changes up to
fa892e9abb728e76afcf27323ab29c57fb0fe7aa:ui/cursor: fix integer overflow in
cursor_alloc(CVE-2021-4206) (2022-04-07 12:30:54 +0200)----------------------------------------------------------------
two cursor/qxl related security fixes.
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.
-- PMM