edk2/EmbeddedPkg
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
..
Application EmbeddedPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
Drivers EmbeddedPkg: align UNI file headers with UNI Spec standard 2026-03-02 19:32:17 +00:00
EmbeddedMonotonicCounter EmbeddedPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
GdbStub EmbeddedPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
Include EmbeddedPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
Library EmbeddedPkg/PrePiLib: Prevent overread with FFS size macros 2026-04-13 14:12:17 +00:00
MetronomeDxe EmbeddedPkg/MetronomeDxe: Update outdated lower bound comment 2022-11-29 19:39:43 +00:00
RealTimeClockRuntimeDxe ArmPlatformPkg,EmbeddedPkg,MdeModulePkg: Move RealTimeClockLib header 2025-09-08 16:54:42 +08:00
Scripts/LauterbachT32 EmbeddedPkg: fix mdlint issues 2026-03-04 22:02:33 +00:00
SimpleTextInOutSerial EmbeddedPkg: CodeQL Fixes. 2025-01-15 11:18:04 +00:00
Test/Mock EmbeddedPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
Universal/MmcDxe EmbeddedPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
EmbeddedPkg.ci.yaml EmbeddedPkg/.ci.yaml: add temporary workaround ECC exception 2024-07-02 13:08:04 +00:00
EmbeddedPkg.dec EmbeddedPkg: Remove DXE_SAL_DRIVER 2025-10-30 10:00:32 +00:00
EmbeddedPkg.dsc EmbeddedPkg: Add LOONGARCH64 and RISCV64 as supported architectures 2025-11-24 04:15:18 +00:00