roms: assert if max rom size is less than the used size
authorIgor Mammedov <imammedo@redhat.com>
Thu, 11 Apr 2019 11:28:18 +0000 (13:28 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 May 2019 09:56:53 +0000 (11:56 +0200)
commit85fad7e11508fd581fdbb14dd6a6555a9e0c8d70
tree0058f3eb489b86a885fccf00356871d113745ea6
parentb92be8d0920021fca4cfac90e552a74ce066a0a3
roms: assert if max rom size is less than the used size

It would ensure that we would notice attempt to write beyond
the allocated buffer. In case of MemoryRegion backed ROM it's
the host buffer and the guest RAM otherwise.

assert can be triggered with:
  dd if=/dev/zero of=/tmp/blob bs=63k count=1
  qemu-system-x86_64 `for  i in {1..33}; do echo -n " -acpitable /tmp/blob"; done`

Fixes: (a1666142db acpi-build: make ROMs RAM blocks resizeable)
Reported-by: Wei Yang <richardw.yang@linux.intel.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1554982098-336210-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/core/loader.c