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>
self._Version = int(Value, 0)\r
elif decVersionPattern.match(Value):\r
ValueList = Value.split('.')\r
self._Version = int(Value, 0)\r
elif decVersionPattern.match(Value):\r
ValueList = Value.split('.')\r
- Major = '%04o' % int(ValueList[0], 0)\r
- Minor = '%04o' % int(ValueList[1], 0)\r
- self._Version = int('0x' + Major + Minor, 0)\r
+ Major = int(ValueList[0], 0)\r
+ Minor = int(ValueList[1], 0)\r
+ if Major > 0xffff or Minor > 0xffff:\r
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",\r
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
+ self._Version = int('0x{0:04x}{1:04x}'.format(Major, Minor), 0)\r
else:\r
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",\r
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
else:\r
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",\r
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r