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: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
\r
if (Len <= TableBits) {\r
\r
+ if (Start[Len] >= NextCode || NextCode > MaxTableLength){\r
+ return (UINT16) BAD_TABLE;\r
+ }\r
+\r
for (Index = Start[Len]; Index < NextCode; Index++) {\r
- if (Index >= MaxTableLength) {\r
- return (UINT16) BAD_TABLE;\r
- }\r
Table[Index] = Char;\r
}\r
\r