Reviewed-by: Yonghong Zhu <yonghong....@intel.com> 

Best Regards,
Zhu Yonghong

-----Original Message-----
From: Gao, Liming 
Sent: Friday, November 09, 2018 7:58 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong....@intel.com>
Subject: [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue

https://bugzilla.tianocore.org/show_bug.cgi?id=1317

This is a regression issue caused by 041d89bc0f0119df37a5fce1d0f16495ff905089.
In Decode() function, once mOutBuf is fully filled, Decode() should return.
Current logic misses the checker of mOutBuf after while() loop.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming....@intel.com>
Cc: Yonghong Zhu <yonghong....@intel.com>
---
 BaseTools/Source/C/Common/Decompress.c           | 6 ++++++
 BaseTools/Source/C/TianoCompress/TianoCompress.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/BaseTools/Source/C/Common/Decompress.c 
b/BaseTools/Source/C/Common/Decompress.c
index 71313b1179..33e0f0d160 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -662,6 +662,12 @@ Returns: (VOID)
 
         BytesRemain--;
       }
+      //
+      // Once mOutBuf is fully filled, directly return
+      //
+      if (Sd->mOutBuf >= Sd->mOrigSize) {
+        return ;
+      }
     }
   }
 
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c 
b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index 2d6fc4c952..a77f6798ec 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -2682,6 +2682,12 @@ Returns: (VOID)
 
         BytesRemain--;
       }
+      //
+      // Once mOutBuf is fully filled, directly return
+      //
+      if (Sd->mOutBuf >= Sd->mOrigSize) {
+        goto Done ;
+      }
     }
   }
 
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to