From: Shenglei Zhang <shenglei.zhang@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [PATCH 3/4] IntelFrameworkModulePkg: Improve performance of boundary validation
Date: Mon, 25 Feb 2019 14:08:07 +0800 [thread overview]
Message-ID: <20190225060808.15332-4-shenglei.zhang@intel.com> (raw)
In-Reply-To: <20190225060808.15332-1-shenglei.zhang@intel.com>
The boundary validation checking in MakeTable() performs on
every loop iteration. This could be improved by checking
just once before the loop.
https://bugzilla.tianocore.org/show_bug.cgi?id=1329
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
.../BaseUefiTianoCustomDecompressLib.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
index 970795b1da..a7ff94920e 100644
--- a/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
+++ b/IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
@@ -213,12 +213,12 @@ MakeTable (
if (Len <= TableBits) {
- for (Index = Start[Len]; Index < NextCode; Index++) {
- if (Index >= MaxTableLength) {
- return (UINT16) BAD_TABLE;
- }
- Table[Index] = Char;
- }
+ if (Start[Len] + NextCode > MaxTableLength) {
+ return (UINT16) BAD_TABLE;
+ }
+ for (Index = Start[Len]; Index < NextCode; Index++) {
+ Table[Index] = Char;
+ }
} else {
--
2.18.0.windows.1
next prev parent reply other threads:[~2019-02-25 6:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 6:08 [PATCH 0/4] Improve performance of boundary validation in MakeTable() Shenglei Zhang
2019-02-25 6:08 ` [PATCH 1/4] BaseTools/TianoCompress: Improve performance of boundary validation Shenglei Zhang
2019-02-25 6:08 ` [PATCH 2/4] BaseTools/C/Common: " Shenglei Zhang
2019-02-25 6:08 ` Shenglei Zhang [this message]
2019-02-25 6:08 ` [PATCH 4/4] MdePkg/BaseUefiDecompressLib: " Shenglei Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190225060808.15332-4-shenglei.zhang@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox