edk2/EmbeddedPkg/Library/PrePiLib
Gowtham M 3b0deb5e79 EmbeddedPkg/PrePiLib: Prevent overread with FFS size macros
Symptom:Unsafe typecasting may lead to out‑of‑bound memory access

RootCause: FileSize and FileLength 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()
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 isssue "OVERRUN"

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
2026-04-13 14:12:17 +00:00
..
FwVol.c EmbeddedPkg/PrePiLib: Prevent overread with FFS size macros 2026-04-13 14:12:17 +00:00
PrePi.h EmbeddedPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
PrePiLib.c EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHook 2023-01-19 08:35:59 +00:00
PrePiLib.inf EmbeddedPkg/PrePiLib: Drop unused PCD PcdPrePiCpuIoSize 2023-02-04 10:55:05 +00:00