edk2/EmulatorPkg/Library
Gowtham M 9989454219 EmulatorPkg/SecPeiServicesLib: Prevent overread with available size macros
Symptom:Unsafe typecasting may lead to out‑of‑bound memory access

RootCause: FileSize, FileLength and SectionLength are declared as
UINT32 and masked with 0x00FFFFFF to store only the lower 24 bits.
Although this approach yields the correct result,
it introduces a potential risk due to unsafe typecasting and
dereferencing.

Solution: Using the predefined macro FFS_FILE_SIZE()
and SECTION_SIZE from MdePkg\Include\Pi\PiFirmwareFile.h,
which safely performs the same operation by reconstructing
the size using individual byte access.

This commit also addresses the fix for coverity issue "OVERRUN"

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
2026-04-13 14:12:17 +00:00
..
DevicePathTextLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeCoreTimerLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeEmuLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeEmuPeCoffExtraActionLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeEmuSerialPortLib EmulatorPkg: Remove unnecessary dependency on EmbeddedPkg 2022-12-08 10:44:20 +00:00
DxeEmuStdErrSerialPortLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeTimerLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
GuardUefiMemoryAllocationLib EmulatorPkg: fix various typos 2025-11-21 21:49:59 +00:00
KeyMapLibNull EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiCoreServicesTablePointerLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiEmuPeCoffExtraActionLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiEmuPeCoffGetEntryPointLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiEmuSerialPortLib EmulatorPkg: Remove unnecessary dependency on EmbeddedPkg 2022-12-08 10:44:20 +00:00
PeiServicesTablePointerLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesTablePointerLibMagicPage EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiTimerLib EmulatorPkg/PeiTimerLib: Bug fix in NanoSecondDelay 2023-02-09 02:04:37 +00:00
PlatformBmLib EmulatorPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
RedfishPlatformCredentialLib EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService 2023-12-27 00:09:49 +00:00
RedfishPlatformHostInterfaceLib EmulatorPkg: Fix EFI_SUCCESS typos 2025-06-12 17:50:45 +00:00
SecPeiServicesLib EmulatorPkg/SecPeiServicesLib: Prevent overread with available size macros 2026-04-13 14:12:17 +00:00
SecPpiListLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmbiosLib EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ThunkPpiList EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ThunkProtocolList EmulatorPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00