REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2686
some GUID include character ' or " ascii value, transfer to string will catch the wrong value. Cc: Bob Feng <bob.c.f...@intel.com> Cc: Liming Gao <liming....@intel.com> Signed-off-by: Yunhua Feng <yunhuax.f...@intel.com> --- BaseTools/Source/Python/Common/Misc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index da5fb380f0..ad55671080 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -37,10 +37,11 @@ from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CopyLongFilePath as CopyLong from Common.LongFilePathSupport import LongFilePath as LongFilePath from Common.MultipleWorkspace import MultipleWorkspace as mws from CommonDataClass.Exceptions import BadExpression from Common.caching import cached_property +import struct ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]") ## Regular expression used to find out place holders in string template gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.UNICODE) @@ -1153,17 +1154,16 @@ def ParseFieldValue (Value): raise BadExpression("Invalid GUID value string %s" % Value) Value = TmpValue if Value[0] == '"' and Value[-1] == '"': Value = Value[1:-1] try: - Value = str(uuid.UUID(Value).bytes_le) - if Value.startswith("b'"): - Value = Value[2:-1] - Value = "'" + Value + "'" + Value = uuid.UUID(Value).bytes_le + ValueL, ValueH = struct.unpack('2Q', Value) + Value = (ValueH << 64 ) | ValueL + except ValueError as Message: raise BadExpression(Message) - Value, Size = ParseFieldValue(Value) return Value, 16 if Value.startswith('L"') and Value.endswith('"'): # Unicode String # translate escape character Value = Value[1:] -- 2.12.2.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58683): https://edk2.groups.io/g/devel/message/58683 Mute This Topic: https://groups.io/mt/74023220/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-