summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorFeng, YunhuaX <YunhuaX.Feng@intel.com>2020-05-09 08:14:44 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-05-13 06:37:18 +0000
commitceacd9e992cd12f3c07ae1a28a75a6b8750718aa (patch)
tree3194c32146304791ca99d8246dfff4305497166e /BaseTools/Source/Python
parent242ab73d7f255d5d859eaf74a23b9d68c686d177 (diff)
downloadedk2-ceacd9e992cd12f3c07ae1a28a75a6b8750718aa.tar.gz
edk2-ceacd9e992cd12f3c07ae1a28a75a6b8750718aa.tar.bz2
edk2-ceacd9e992cd12f3c07ae1a28a75a6b8750718aa.zip
BaseTools: Fix parse PCD GUID expression issue
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2686 The build tool will give an incorrect GUID value if the GUID includes character ' or " ASCII value. This patch is going to fix this issue. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python')
-rwxr-xr-xBaseTools/Source/Python/Common/Misc.py10
1 files 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
@@ -39,6 +39,7 @@ 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
@@ -1155,13 +1156,12 @@ def ParseFieldValue (Value):
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