From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Yunhua Feng <yunhuax.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect
Date: Wed, 25 Jul 2018 11:40:41 +0800 [thread overview]
Message-ID: <1532490041-516-1-git-send-email-yonghong.zhu@intel.com> (raw)
From: Yunhua Feng <yunhuax.feng@intel.com>
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>
---
BaseTools/Source/Python/Workspace/MetaFileParser.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index fbfc182c8b..250cbf79a9 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -374,13 +374,16 @@ class MetaFileParser(object):
if Name == 'INF_VERSION':
if hexVersionPattern.match(Value):
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)
if isinstance(self, InfParser) and self._Version < 0x00010005:
--
2.12.2.windows.2
next reply other threads:[~2018-07-25 3:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-25 3:40 Yonghong Zhu [this message]
2018-07-26 0:41 ` [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect Zhu, Yonghong
2018-07-26 1:23 ` Carsey, Jaben
2018-07-26 1:41 ` Zhu, Yonghong
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=1532490041-516-1-git-send-email-yonghong.zhu@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