MdeModulePkg/Core/Pei: Add error handling for Section Length

This patch breaks the section processing loop if an invalid section with zero SectionLength is encountered.

Signed-off-by: Ragavarshini B <ragavarshinib@ami.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dhanaraj V <vdhanaraj@ami.com>
Cc: Sachin Ganesh <sachinganesh@ami.com>
This commit is contained in:
ragavarshinib 2024-08-29 16:10:26 +05:30 committed by mergify[bot]
parent 9dabe005f0
commit 253b3d678a
1 changed files with 12 additions and 0 deletions

View File

@ -819,6 +819,10 @@ ProcessSection (
if (!IsFfs3Fv) {
DEBUG ((DEBUG_ERROR, "Found a FFS3 formatted section in a non-FFS3 formatted FV.\n"));
SectionLength = SECTION2_SIZE (Section);
if (SectionLength == 0) {
break;
}
//
// SectionLength is adjusted it is 4 byte aligned.
// Go to the next section
@ -854,6 +858,10 @@ ProcessSection (
SectionLength = SECTION_SIZE (Section);
}
if (SectionLength == 0) {
break;
}
//
// SectionLength is adjusted it is 4 byte aligned.
// Go to the next section
@ -991,6 +999,10 @@ ProcessSection (
SectionLength = SECTION_SIZE (Section);
}
if (SectionLength == 0) {
break;
}
//
// SectionLength is adjusted it is 4 byte aligned.
// Go to the next section