diff options
author | Michael D Kinney <michael.d.kinney@intel.com> | 2023-03-11 11:31:51 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-03-13 22:11:55 +0000 |
commit | e4c1d8d2317984bd9cb447eba916956841063ec4 (patch) | |
tree | f62faf000feeda5676f6a8b1de08fb40b28ccd14 | |
parent | d2bfe289668e32940cca5da12bc201bf9b6c84d8 (diff) | |
download | edk2-e4c1d8d2317984bd9cb447eba916956841063ec4.tar.gz edk2-e4c1d8d2317984bd9cb447eba916956841063ec4.tar.bz2 edk2-e4c1d8d2317984bd9cb447eba916956841063ec4.zip |
ShellPkg/Library: Fix 32-bit truncation of pointer values
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4366
Update C and UNI files that are incorrectly using %x or %08x
instead of %p for pointer values. On 64-bit systems, this is
truncating pointer values above 4GB.
In reviewing ShellPkg for this issue some unused UNI strings
with incorrect format specifiers were removed instead of being
fixed.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
5 files changed, 12 insertions, 44 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni index aa3396cea9..6bcb3cd9e4 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni @@ -173,7 +173,7 @@ #string STR_HII #language en-US "HII"
#string STR_HII_FORM_CALLBACK #language en-US "HIICallback"
-#string STR_TXT_OUT_DUMP_HEADER #language en-US " Address: %%H%X%%N Attrib %02x"
+#string STR_TXT_OUT_DUMP_HEADER #language en-US " Address: %%H%p%%N Attrib %02x"
#string STR_TXT_OUT_DUMP_LINE #language en-US "\r\n %c mode %d: Col %d Row %d"
#string STR_DRIVER_FAM_OVERRIDE #language en-US "DriverFamilyOverride"
@@ -361,7 +361,7 @@ #string STR_DEBUGSUPPORT_INFO #language en-US " Isa = %s"
#string STR_DEBUGSUPPORT_UNKNOWN #language en-US " Unknown (%%H%s%%N)"
-#string STR_PCIRB_DUMP_PH #language en-US " ParentHandle..: %%H%x%%N\r\n"
+#string STR_PCIRB_DUMP_PH #language en-US " ParentHandle..: %%H%p%%N\r\n"
#string STR_PCIRB_DUMP_SEG #language en-US " Segment #.....: %%H%x%%N\r\n"
#string STR_PCIRB_DUMP_ATT #language en-US " Attributes....: %%H%x%%N\r\n"
#string STR_PCIRB_DUMP_SUPPORTS #language en-US " Supports......: %%H%x%%N\r\n"
@@ -375,7 +375,7 @@ " Device #......: %02x\r\n"
" Function #....: %02x\r\n"
" ROM Size......: %lx\r\n"
- " ROM Location..: %08x\r\n"
+ " ROM Location..: %p\r\n"
" Vendor ID.....: %04x\r\n"
" Device ID.....: %04x\r\n"
" Class Code....: %02x %02x %02x\r\n"
@@ -388,18 +388,18 @@ #string STR_LI_DUMP_NAME #language en-US " Name..........: %%H%s%%N\r\n"
#string STR_LI_DUMP_MAIN #language en-US " Revision......: %%H0x%08x%%N\r\n"
- " ParentHandle..: %%H%x%%N\r\n"
- " SystemTable...: %%H%x%%N\r\n"
- " DeviceHandle..: %%H%x%%N\r\n"
+ " ParentHandle..: %%H%p%%N\r\n"
+ " SystemTable...: %%H%p%%N\r\n"
+ " DeviceHandle..: %%H%p%%N\r\n"
" FilePath......: %%H%s%%N\r\n"
" PdbFileName...: %%H%a%%N\r\n"
" OptionsSize...: %%H%x%%N\r\n"
- " LoadOptions...: %%H%x%%N\r\n"
- " ImageBase.....: %%H%x%%N\r\n"
+ " LoadOptions...: %%H%p%%N\r\n"
+ " ImageBase.....: %%H%p%%N\r\n"
" ImageSize.....: %%H%Lx%%N\r\n"
" CodeType......: %%H%s%%N\r\n"
" DataType......: %%H%s%%N\r\n"
- " Unload........: %%H%x%%N"
+ " Unload........: %%H%p%%N"
#string STR_GOP_DUMP_MAIN #language en-US " Max Mode..............: %%H0x%08x%%N\r\n"
" Current Mode..........: %%H0x%08x%%N\r\n"
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni index b1d239ed37..4fedc0d149 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni @@ -103,7 +103,6 @@ #string STR_DMEM_HEADER_ROW #language en-US "Memory Address %016LX %X Bytes\r\n"
#string STR_DMEM_MMIO_HEADER_ROW #language en-US "Memory Mapped IO Address %016LX %X Bytes\r\n"
-#string STR_DMEM_DATA_ROW #language en-US "%08X: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x *%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c*\r\n"
#string STR_DMEM_SYSTEM_TABLE #language en-US "\r\nValid EFI Header at Address %016Lx\r\n"
"---------------------------------------------\r\n"
"System: Table Structure size %08x revision %08x\r\n"
@@ -1171,4 +1170,3 @@ " \r\n"
" * To edit memory region starting at address 0x00000000 with size of 2 bytes:\r\n"
" fs0:\> hexedit -m 0 2\r\n"
-
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c index dd9aba50d7..d17d50fe13 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c @@ -325,7 +325,7 @@ GetProtocolInfoString ( Status = gBS->HandleProtocol (TheHandle, ProtocolGuidArray[ProtocolIndex], &Instance);
if (!EFI_ERROR (Status)) {
StrnCatGrow (&RetVal, &Size, L"(%H", 0);
- UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%x", Instance);
+ UnicodeSPrint (InstanceStr, sizeof (InstanceStr), L"%p", Instance);
StrnCatGrow (&RetVal, &Size, InstanceStr, 0);
StrnCatGrow (&RetVal, &Size, L"%N)", 0);
}
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni index fc4986c8c6..230779a4b3 100644 --- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.uni @@ -101,7 +101,7 @@ #string STR_DH_OUTPUT_GUID_HEADER #language en-US "Handle dump by protocol '%g'\r\n"
#string STR_DH_OUTPUT_NAME_HEADER #language en-US "Handle dump by protocol '%s'\r\n"
#string STR_DH_OUTPUT_SINGLE_D #language en-US "%H%02x%N: %s\r\n"
-#string STR_DH_OUTPUT_SINGLE #language en-US "%H%02x%N: %x\r\n%s"
+#string STR_DH_OUTPUT_SINGLE #language en-US "%H%02x%N: %p\r\n%s"
#string STR_DH_OUTPUT_SFO #language en-US "%s, %s, %s, %H%02x%N, %s, %s\r\n"
#string STR_DH_OUTPUT_DRIVER1 #language en-US " Controller Name : %H%s%N\r\n"
#string STR_DH_OUTPUT_DRIVER2 #language en-US " Device Path : %H%s%N\r\n"
@@ -128,18 +128,6 @@ #string STR_DEV_TREE_OUTPUT #language en-US "Ctrl[%H%02x%N] %s\r\n"
#string STR_UNLOAD_CONF #language en-US "%HUnload%N - Handle [%H%02x%N]. [y/n]?\r\n"
-#string STR_UNLOAD_VERBOSE #language en-US ""
-"Handle [%H%02x%N] (%08x)\r\n"
-" Image (%08x)\r\n"
-" ParentHandle..: %08x\r\n"
-" SystemTable...: %08x\r\n"
-" DeviceHandle..: %08x\r\n"
-" FilePath......: %s\r\n"
-" PDBFileName...: %a\r\n"
-" ImageBase.....: %08x\r\n"
-" ImageSize.....: %Ld\r\n"
-" CodeType......: %s\r\n"
-" DataType......: %s\r\n"
#string STR_OPENINFO_HEADER_LINE #language en-US "Handle %H%02x%N (%H%0p%N)\r\n"
#string STR_OPENINFO_LINE #language en-US " Drv[%H%02x%N] Ctrl[%H%02x%N] Cnt(%H%02x%N) %H%s Image%N(%s)\r\n"
@@ -734,20 +722,3 @@ " violation.\r\n"
" SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n"
" formatted or its value was out of bounds.\r\n"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni index 8ce015746f..0a0cd3090e 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni @@ -134,7 +134,7 @@ #string STR_LOAD_NOT_IMAGE #language en-US "Image '%s' is not an image.\r\n"
#string STR_LOAD_NOT_DRIVER #language en-US "Image '%s' is not a driver.\r\n"
-#string STR_LOAD_LOADED #language en-US "Image '%s' loaded at %x - %r\r\n"
+#string STR_LOAD_LOADED #language en-US "Image '%s' loaded at %p - %r\r\n"
#string STR_LOAD_ERROR #language en-US "Image '%s' error in StartImage: %r\r\n"
#string STR_LS_LINE_START_ALL #language en-US "%t %5s %1c % ,L11d "
@@ -1076,4 +1076,3 @@ " SHELL_SECURITY_VIOLATION This function was not performed due to a security\r\n"
" violation.\r\n"
" SHELL_NOT_FOUND The target file-system was not found.\r\n"
-
|