diff options
author | Dimitrije Pavlov <Dimitrije.Pavlov@arm.com> | 2022-07-28 16:30:42 -0500 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-08-01 20:34:21 +0000 |
commit | 19cbfaa4319edabf5feb4e9d867f042c2d5e72b6 (patch) | |
tree | f5f02091086ce4de94b071c54f13001b45de8cd8 /OvmfPkg/QemuVideoDxe | |
parent | 6f4e10d6db316c279ed90036c9a206a1b89f0878 (diff) | |
download | edk2-19cbfaa4319edabf5feb4e9d867f042c2d5e72b6.tar.gz edk2-19cbfaa4319edabf5feb4e9d867f042c2d5e72b6.tar.bz2 edk2-19cbfaa4319edabf5feb4e9d867f042c2d5e72b6.zip |
OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
Ensure that the PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
PixelBlueGreenRedReserved8BitPerColor.
According to UEFI 2.9 Section 12.9, PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
PixelFormat is PixelBitMask. This means that firmware is not required
to fill out the PixelInformation field for other PixelFormat types,
which implies that the QemuVideoDxe implementation is technically
correct.
However, not zeroing out those fields will leak the contents of the
memory returned by the memory allocator, so it is better to explicitly
set them to zero.
In addition, the SCT test suite relies on PixelInformation always
having a consistent value, which causes failures.
Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'OvmfPkg/QemuVideoDxe')
-rw-r--r-- | OvmfPkg/QemuVideoDxe/Gop.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c index 0c4dea7fb6..7a9fe208c9 100644 --- a/OvmfPkg/QemuVideoDxe/Gop.c +++ b/OvmfPkg/QemuVideoDxe/Gop.c @@ -31,7 +31,14 @@ QemuVideoCompleteModeInfo ( Info->PixelInformation.ReservedMask = 0;
} else if (ModeData->ColorDepth == 32) {
DEBUG ((DEBUG_INFO, "PixelBlueGreenRedReserved8BitPerColor\n"));
- Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
+ Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
+ Info->PixelInformation.RedMask = 0;
+ Info->PixelInformation.GreenMask = 0;
+ Info->PixelInformation.BlueMask = 0;
+ Info->PixelInformation.ReservedMask = 0;
+ } else {
+ DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__, ModeData->ColorDepth));
+ ASSERT (FALSE);
}
Info->PixelsPerScanLine = Info->HorizontalResolution;
|