qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on migration load
@ 2019-07-05  7:39 Marc-André Lureau
  2019-07-05  7:43 ` Marc-André Lureau
  0 siblings, 1 reply; 2+ messages in thread
From: Marc-André Lureau @ 2019-07-05  7:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, kraxel, qemu-stable

NO_INTERFACE_INFO (255) is used to indicate no info.

/home/elmarco/src/qemu/hw/usb/redirect.c:1504:71: runtime error: index 32 out of bounds for type 'uint8_t [32]'
/home/elmarco/src/qemu/hw/usb/redirect.c:1503:71: runtime error: index 32 out of bounds for type 'uint8_t [32]'
/home/elmarco/src/qemu/hw/usb/redirect.c:1502:68: runtime error: index 32 out of bounds for type 'uint8_t [32]'
=================================================================
==32073==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000252930 at pc 0x556c5126b0b6 bp 0x7fc7793ffa50 sp 0x7fc7793ffa40
READ of size 1 at 0x625000252930 thread T0
    #0 0x556c5126b0b5 in usbredir_check_bulk_receiving /home/elmarco/src/qemu/hw/usb/redirect.c:1504
    #1 0x556c51275a2a in usbredir_post_load /home/elmarco/src/qemu/hw/usb/redirect.c:2154
    #2 0x556c51306f5e in vmstate_load_state /home/elmarco/src/qemu/migration/vmstate.c:168
    #3 0x556c512efb43 in vmstate_load /home/elmarco/src/qemu/migration/savevm.c:829
    #4 0x556c512f9967 in qemu_loadvm_section_start_full /home/elmarco/src/qemu/migration/savevm.c:2212
    #5 0x556c512faee1 in qemu_loadvm_state_main /home/elmarco/src/qemu/migration/savevm.c:2396
    #6 0x556c512fb16b in qemu_loadvm_state /home/elmarco/src/qemu/migration/savevm.c:2468
    #7 0x556c512c0d2b in process_incoming_migration_co /home/elmarco/src/qemu/migration/migration.c:449
    #8 0x556c51b62bcc in coroutine_trampoline /home/elmarco/src/qemu/util/coroutine-ucontext.c:115
    #9 0x7fc80fba637f  (/lib64/libc.so.6+0x4d37f)

Cc: qemu-stable@nongnu.org
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/usb/redirect.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 998fc6e4b0..3bda19bd64 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1495,6 +1495,9 @@ static void usbredir_check_bulk_receiving(USBRedirDevice *dev)
     for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
         dev->endpoint[i].bulk_receiving_enabled = 0;
     }
+    if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
+        return;
+    }
     for (i = 0; i < dev->interface_info.interface_count; i++) {
         quirks = usb_get_quirks(dev->device_info.vendor_id,
                                 dev->device_info.product_id,
-- 
2.22.0.214.g8dca754b1e



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-05  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-05  7:39 [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on migration load Marc-André Lureau
2019-07-05  7:43 ` Marc-André Lureau

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).