OSDN Git Service

hw/i386: Improve bounds checking in OVMF table parsing
authorDov Murik <dovmurik@linux.ibm.com>
Tue, 22 Feb 2022 07:19:05 +0000 (07:19 +0000)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 4 Mar 2022 10:24:52 +0000 (11:24 +0100)
commit64915058e18c2fbff8c80f9ad2e5be854dee2965
treeeb61900e92ff9f9870ce9527d4ad0b83b6558c63
parentbd7819de227f47df72e21558c019147673726a74
hw/i386: Improve bounds checking in OVMF table parsing

When pc_system_parse_ovmf_flash() parses the optional GUIDed table in
the end of the OVMF flash memory area, the table length field is checked
for sizes that are too small, but doesn't error on sizes that are too
big (bigger than the flash content itself).

Add a check for maximal size of the OVMF table, and add an error report
in case the size is invalid.  In such a case, an error like this will be
displayed during launch:

    qemu-system-x86_64: OVMF table has invalid size 4047

and the table parsing is skipped.

Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220222071906.2632426-2-dovmurik@linux.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/i386/pc_sysfw_ovmf.c