qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] usbredir: fix buffer-overflow on migration load


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on migration load
Date: Fri, 5 Jul 2019 11:39:57 +0400

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: address@hidden
Signed-off-by: Marc-André Lureau <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]