audk/OvmfPkg/QemuVideoDxe
Laszlo Ersek 52d229238b OvmfPkg/QemuVideoDxe: avoid arithmetic on null pointer
The real mode interrupt vector table, which we modify for the sake of
Windows 7, starts at address 0, which happens to be the representation of
null pointers on all edk2 architectures. A null pointer may never undergo
pointer arithmetic, and RH covscan justifiedly reports:

> Error: CPPCHECK_WARNING (CWE-682):
> edk2-89910a39dcfd/OvmfPkg/QemuVideoDxe/VbeShim.c:105:
> error[nullPointerArithmetic]: Pointer addition with NULL pointer.
> #  103|     //
> #  104|     Segment0Pages = 1;
> #  105|->   Int0x10       = (IVT_ENTRY *)(UINTN)Segment0 + 0x10;
> #  106|     Segment0AllocationStatus = gBS->AllocatePages (
> #  107|                                       AllocateAddress,

Fix this by calculating the EFI_PHYSICAL_ADDRESS of IVT entry 0x10 first,
and by casting the address to the right type second.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1710
Issue: scan-1002.txt
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2019-04-18 16:03:38 +02:00
..
ComponentName.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Driver.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
DriverSupportedEfiVersion.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Gop.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Initialize.c OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
Qemu.h OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
QemuVideoDxe.inf OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
VbeShim.asm OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00
VbeShim.c OvmfPkg/QemuVideoDxe: avoid arithmetic on null pointer 2019-04-18 16:03:38 +02:00
VbeShim.h OvmfPkg: QemuVideoDxe: Int10h stub for Windows 7 & 2008 (stdvga, QXL) 2014-05-20 16:33:00 +00:00
VbeShim.sh OvmfPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:19 -07:00