summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace
diff options
context:
space:
mode:
authorYunhua Feng <yunhuax.feng@intel.com>2018-07-25 11:21:07 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-07-27 13:43:40 +0800
commitf413763b6b8f2798595d468cf868ae5985d3eabc (patch)
treef06e3c5a4fece61a5c21ada8c0134954ef4ad170 /BaseTools/Source/Python/Workspace
parent07eba7069d4c23e9b15caa1e729682a88ddf4ada (diff)
downloadedk2-f413763b6b8f2798595d468cf868ae5985d3eabc.tar.gz
edk2-f413763b6b8f2798595d468cf868ae5985d3eabc.tar.bz2
edk2-f413763b6b8f2798595d468cf868ae5985d3eabc.zip
BaseTools: Parse decimal format INF_VERSION incorrect
hex number 0x00010019, the major number is 0001, the minor number is 0019. the decimal number 1.25, the major number is 1, and the minor number is 25 Fix https://bugzilla.tianocore.org/show_bug.cgi?id=921 Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index fbfc182c8b..2b1ab40439 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -376,9 +376,12 @@ class MetaFileParser(object):
self._Version = int(Value, 0)
elif decVersionPattern.match(Value):
ValueList = Value.split('.')
- Major = '%04o' % int(ValueList[0], 0)
- Minor = '%04o' % int(ValueList[1], 0)
- self._Version = int('0x' + Major + Minor, 0)
+ Major = int(ValueList[0], 0)
+ Minor = int(ValueList[1], 0)
+ if Major > 0xffff or Minor > 0xffff:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+ self._Version = int('0x{0:04x}{1:04x}'.format(Major, Minor), 0)
else:
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)