* [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking
@ 2022-01-24 9:10 Vin Xue
2022-02-22 5:54 ` Vin Xue
0 siblings, 1 reply; 2+ messages in thread
From: Vin Xue @ 2022-01-24 9:10 UTC (permalink / raw)
To: devel; +Cc: Bob Feng, Liming Gao, Yuwei Chen
When creating FIT table, if a IBB FV (e.g. Security FV) is blow ACM FV
( e.g. Firmware Binaries FV), but the size of IBB FV is smaller than
ACM FV, it will cause overflow issue, unexpected split will happen.
Added a statement checking to avoid this issue.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Vin Xue <vinxue@outlook.com>
---
Silicon/Intel/Tools/FitGen/FitGen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index 290e688f6e..3cb8516757 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -759,7 +759,7 @@ CheckOverlap (
INTN Index;
for (Index = 0; Index < (INTN)gFitTableContext.BiosModuleNumber; Index ++) {
- if ((gFitTableContext.BiosModule[Index].Address <= Address) &&
+ if ((gFitTableContext.BiosModule[Index].Address <= Address) && (gFitTableContext.BiosModule[Index].Size >= Size) &&
((gFitTableContext.BiosModule[Index].Size - Size) >= (Address - gFitTableContext.BiosModule[Index].Address))) {
UINT32 TempSize;
INT32 SubIndex;
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking
2022-01-24 9:10 [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking Vin Xue
@ 2022-02-22 5:54 ` Vin Xue
0 siblings, 0 replies; 2+ messages in thread
From: Vin Xue @ 2022-02-22 5:54 UTC (permalink / raw)
To: devel@edk2.groups.io; +Cc: Bob Feng, Liming Gao, Yuwei Chen
[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]
Hi Sir,
Could you help to review this simple change? It was verified on Client BIOS. Thanks.
________________________________
From: Vin Xue <vinxue@outlook.com>
Sent: Monday, January 24, 2022 5:09 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Bob Feng <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com>
Subject: [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking
When creating FIT table, if a IBB FV (e.g. Security FV) is blow ACM FV
( e.g. Firmware Binaries FV), but the size of IBB FV is smaller than
ACM FV, it will cause overflow issue, unexpected split will happen.
Added a statement checking to avoid this issue.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Vin Xue <vinxue@outlook.com>
---
Silicon/Intel/Tools/FitGen/FitGen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index 290e688f6e..3cb8516757 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -759,7 +759,7 @@ CheckOverlap (
INTN Index;
for (Index = 0; Index < (INTN)gFitTableContext.BiosModuleNumber; Index ++) {
- if ((gFitTableContext.BiosModule[Index].Address <= Address) &&
+ if ((gFitTableContext.BiosModule[Index].Address <= Address) && (gFitTableContext.BiosModule[Index].Size >= Size) &&
((gFitTableContext.BiosModule[Index].Size - Size) >= (Address - gFitTableContext.BiosModule[Index].Address))) {
UINT32 TempSize;
INT32 SubIndex;
--
2.31.1.windows.1
[-- Attachment #2: Type: text/html, Size: 3272 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-22 5:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-24 9:10 [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking Vin Xue
2022-02-22 5:54 ` Vin Xue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox