[edk2-devel] [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking

Vin Xue vinxue at outlook.com
Mon Jan 24 09:10:11 UTC 2022


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 at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen at intel.com>
Signed-off-by: Vin Xue <vinxue at 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86033): https://edk2.groups.io/g/devel/message/86033
Mute This Topic: https://groups.io/mt/88658814/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list