From c3e6e90b366affbb99ba1ced15a1ec4304efad2f Mon Sep 17 00:00:00 2001 From: espes Date: Sun, 31 Mar 2013 09:07:09 +1000 Subject: [PATCH] don't crash when xbox bios not specified --- hw/i386/xbox.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/i386/xbox.c b/hw/i386/xbox.c index 4f21749537..54d980c580 100644 --- a/hw/i386/xbox.c +++ b/hw/i386/xbox.c @@ -81,12 +81,17 @@ static void xbox_memory_init(MemoryRegion *system_memory, } else { bios_size = -1; } + if (bios_size <= 0 || + (bios_size % 65536) != 0) { + goto bios_error; + } bios = g_malloc(sizeof(*bios)); memory_region_init_ram(bios, "xbox.bios", bios_size); vmstate_register_ram_global(bios); memory_region_set_readonly(bios, true); ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1); if (ret != 0) { +bios_error: fprintf(stderr, "qemu: could not load xbox BIOS '%s'\n", bios_name); exit(1); }