audk/MdePkg/Library
Michael Kubacki 321240b135 MdePkg: Fix conditionally uninitialized variables
Fixes CodeQL alerts for CWE-457:
https://cwe.mitre.org/data/definitions/457.html

Note that this change affects the actual return value from the
following functions. The functions documented that if an integer
overflow occurred, MAX_UINTN would be returned. They were
implemented to actually return an undefined value from the stack.

This change makes the function follow its description. However, this
is technically different than what callers may have previously
expected.

MdePkg/Library/BaseLib/String.c:
  - StrDecimalToUintn()
  - StrDecimalToUint64()
  - StrHexToUintn()
  - StrHexToUint64()
  - AsciiStrDecimalToUintn()
  - AsciiStrDecimalToUint64()
  - AsciiStrHexToUintn()
  - AsciiStrHexToUint64()

Cc: Erich McMillan <emcmillan@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Co-authored-by: Erich McMillan <emcmillan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
2023-04-03 15:29:08 +00:00
..
BaseArmTrngLibNull MdePkg/ArmTrngLib: Add NULL instance of Arm TRNG Library 2022-11-06 16:32:28 +00:00
BaseCacheMaintenanceLib MdePkg: Update code to be more C11 compliant by using __func__ 2023-03-17 17:55:48 +00:00
BaseCacheMaintenanceLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseCpuLib MdePkg/BaseCpuLib AARCH64: Make asm files BTI compatible 2023-03-30 11:05:22 +00:00
BaseCpuLibNull MdePkg/BaseCpuLibNull: Add Null version of CpuLib for host testing 2020-07-15 05:25:21 +00:00
BaseDebugLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseDebugLibSerialPort MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseDebugPrintErrorLevelLib MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BaseExtractGuidedSectionLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseIoLibIntrinsic MdePkg/BaseIoLibIntrinsic AARCH64: Make asm files BTI compatible 2023-03-30 11:05:22 +00:00
BaseLib MdePkg: Fix conditionally uninitialized variables 2023-04-03 15:29:08 +00:00
BaseMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseMemoryLibMmx MdePkg: Replace Opcode with the corresponding instructions. 2022-03-01 01:45:47 +00:00
BaseMemoryLibOptDxe MdePkg/BaseMemoryLibOptDxe AARCH64: Make asm files BTI compatible 2023-03-30 11:05:22 +00:00
BaseMemoryLibOptPei MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseMemoryLibRepStr MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseMemoryLibSse2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseOrderedCollectionRedBlackTreeLib MdePkg: Update code to be more C11 compliant by using __func__ 2023-03-17 17:55:48 +00:00
BasePcdLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciCf8Lib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciExpressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciLibCf8 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciLibPciExpress MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePciSegmentInfoLibNull MdePkg/PciSegmentInfoLib: Add missing EFIAPI to GetPciSegmentInfo() 2020-06-24 05:46:27 +00:00
BasePciSegmentLibPci MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePeCoffExtraActionLibNull MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BasePeCoffGetEntryPointLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePeCoffLib MdePkg: BasePeCoffLib: Allow AArch64 and x64 images in ImageFormatSupported 2023-03-08 18:10:34 +00:00
BasePerformanceLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePostCodeLibDebug MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePostCodeLibPort80 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BasePrintLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseReportStatusCodeLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseRiscVSbiLib MdePkg: Add BaseRiscVSbiLib Library for RISC-V 2023-02-16 05:53:28 +00:00
BaseRngLib MdePkg/BaseRngLib AARCH64: Make asm files BTI compatible 2023-03-30 11:05:22 +00:00
BaseRngLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseRngLibTimerLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3BootScriptLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3IoLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3PciLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3PciSegmentLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3SmbusLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseS3StallLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseSafeIntLib MdePkg/BaseSafeIntLib: Add LoongArch64 architecture for BaseSafeIntLib. 2022-10-14 02:16:33 +00:00
BaseSerialPortLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseSmbusLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseStackCheckLib MdePkg: Remove RVCT support 2022-05-13 14:58:54 +00:00
BaseSynchronizationLib MdePkg/BaseSynchronizationLib AARCH64: Make asm files BTI compatible 2023-03-30 11:05:22 +00:00
BaseTimerLibNullTemplate MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseUefiDecompressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
CcProbeLibNull MdePkg: Add CcProbeLibNull 2022-04-19 01:26:08 +00:00
DxeCoreEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeCoreHobLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeExtractGuidedSectionLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeHobLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeHstiLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeIoLibCpuIo2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxePcdLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeRngLib MdePkg: Update code to be more C11 compliant by using __func__ 2023-03-17 17:55:48 +00:00
DxeRuntimeDebugLibSerialPort MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeRuntimePciExpressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeServicesLib MdePkg/DxeServicesLib: Add LOONGARCH64 architecture 2022-10-14 02:16:33 +00:00
DxeServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeSmbusLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MmServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MmUnblockMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PciSegmentLibSegmentInfo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiCoreEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiDxePostCodeLibReportStatusCode MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiExtractGuidedSectionLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiHobLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiIoLibCpuIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiMemoryAllocationLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiPcdLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiPciLibPciCfg2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiPciSegmentLibPciCfg2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiResourcePublicationLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesTablePointerLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesTablePointerLibIdt MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiSmbusLibSmbus2Ppi MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeimEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RegisterFilterLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SecPeiDxeTimerLibCpu MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmiHandlerProfileLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmCpuRendezvousLibNull MdePkg: Remove "assert" from SmmCpuRendevousLibNull.c 2022-06-13 01:37:16 +00:00
SmmIoLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmIoLibSmmCpuIo2 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmLibNull MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmMemLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmMemoryAllocationLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmPciExpressLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmPciLibPciRootBridgeIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmPeriodicSmiLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
StandaloneMmDriverEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
StandaloneMmServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
TdxLib MdePkg: Add TdxLib to wrap Tdx operations 2022-04-02 08:15:12 +00:00
UefiApplicationEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiBootServicesTableLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDebugLibConOut MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDebugLibDebugPortProtocol MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDebugLibStdErr MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDevicePathLib MdePkg/Library/UefiDevicePathLib: Add back StandaloneMm INF file 2022-08-10 21:43:49 +00:00
UefiDevicePathLibDevicePathProtocol MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDriverEntryPoint MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiFileHandleLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiLib MdePkg: Added Call for AfterReadyToBoot Event 2023-02-15 12:34:20 +00:00
UefiMemoryAllocationLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiMemoryLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiPciLibPciRootBridgeIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiPciSegmentLibPciRootBridgeIo MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiRuntimeLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiRuntimeServicesTableLib MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiScsiLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiUsbLib MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00