]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix flexible PCD DEVICE_PATH parse issue
authorFeng, YunhuaX </o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Feng, YunhuaX4e1>
Tue, 6 Feb 2018 02:19:49 +0000 (10:19 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 7 Feb 2018 01:28:44 +0000 (09:28 +0800)
When the format of DEVICE_PATH have string, like as:
{DEVICE_PATH("BBS(1,"AB",0)")} have string "AB", will
get the wrong value.

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>
BaseTools/Source/Python/Common/Misc.py

index b8c2ce1ddccf9345671f76fcda4af9468ca10eab..0365ac95314cd202f909bc219b4356cae04eb2ac 100644 (file)
@@ -1603,7 +1603,8 @@ def ParseFieldValue (Value):
                 Value = (Value << 8) | ((ItemValue >> 8 * I) & 0xff)\r
         return Value, RetSize\r
     if Value.startswith('DEVICE_PATH(') and Value.endswith(')'):\r
                 Value = (Value << 8) | ((ItemValue >> 8 * I) & 0xff)\r
         return Value, RetSize\r
     if Value.startswith('DEVICE_PATH(') and Value.endswith(')'):\r
-        Value = Value.split('"')[1]\r
+        Value = Value.replace("DEVICE_PATH(", '').rstrip(')')\r
+        Value = Value.strip().strip('"')\r
         return ParseDevPathValue(Value)\r
     if Value.lower().startswith('0x'):\r
         Value = int(Value, 16)\r
         return ParseDevPathValue(Value)\r
     if Value.lower().startswith('0x'):\r
         Value = int(Value, 16)\r