mirror of https://github.com/acidanthera/audk.git
https://bugzilla.tianocore.org/show_bug.cgi?id=798 SafeIntLib provides helper functions to prevent integer overflow during type conversion, addition, subtraction, and multiplication. Conversion Functions ==================== * Converting from a signed type to an unsigned type of the same size, or vice-versa. * Converting to a smaller type that could possibly overflow. * Converting from a signed type to a larger unsigned type. Unsigned Addition, Subtraction, Multiplication =============================================== * Unsigned integer math functions protect from overflow and underflow (in case of subtraction). Signed Addition, Subtraction, Multiplication ============================================ * Strongly consider using unsigned numbers. * Signed numbers are often used where unsigned numbers should be used. For example file sizes and array indices should always be unsigned. Subtracting a larger positive signed number from a smaller positive signed number with SafeInt32Sub() will succeed, producing a negative number, that then must not be used as an array index (but can occasionally be used as a pointer index.) Similarly for adding a larger magnitude negative number to a smaller magnitude positive number. * SafeIntLib does not protect you from such errors. It tells you if your integer operations overflowed, not if you are doing the right thing with your non-overflowed integers. * Likewise you can overflow a buffer with a non-overflowed unsigned index. Based on content from the following branch/commits: https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport |
||
---|---|---|
.. | ||
BaseCacheMaintenanceLib | ||
BaseCpuLib | ||
BaseDebugLibNull | ||
BaseDebugLibSerialPort | ||
BaseDebugPrintErrorLevelLib | ||
BaseExtractGuidedSectionLib | ||
BaseIoLibIntrinsic | ||
BaseLib | ||
BaseMemoryLib | ||
BaseMemoryLibMmx | ||
BaseMemoryLibOptDxe | ||
BaseMemoryLibOptPei | ||
BaseMemoryLibRepStr | ||
BaseMemoryLibSse2 | ||
BaseOrderedCollectionRedBlackTreeLib | ||
BasePalLibNull | ||
BasePcdLibNull | ||
BasePciCf8Lib | ||
BasePciExpressLib | ||
BasePciLibCf8 | ||
BasePciLibPciExpress | ||
BasePciSegmentInfoLibNull | ||
BasePciSegmentLibPci | ||
BasePeCoffExtraActionLibNull | ||
BasePeCoffGetEntryPointLib | ||
BasePeCoffLib | ||
BasePerformanceLibNull | ||
BasePostCodeLibDebug | ||
BasePostCodeLibPort80 | ||
BasePrintLib | ||
BaseReportStatusCodeLibNull | ||
BaseRngLib | ||
BaseS3BootScriptLibNull | ||
BaseS3IoLib | ||
BaseS3PciLib | ||
BaseS3PciSegmentLib | ||
BaseS3SmbusLib | ||
BaseS3StallLib | ||
BaseSafeIntLib | ||
BaseSerialPortLibNull | ||
BaseSmbusLibNull | ||
BaseStackCheckLib | ||
BaseSynchronizationLib | ||
BaseTimerLibNullTemplate | ||
BaseUefiDecompressLib | ||
DxeCoreEntryPoint | ||
DxeCoreHobLib | ||
DxeExtendedSalLib | ||
DxeExtractGuidedSectionLib | ||
DxeHobLib | ||
DxeHstiLib | ||
DxeIoLibCpuIo2 | ||
DxeIoLibEsal | ||
DxePalLibEsal | ||
DxePcdLib | ||
DxePciLibEsal | ||
DxePciSegmentLibEsal | ||
DxeRuntimeExtendedSalLib | ||
DxeRuntimePciExpressLib | ||
DxeSalLibEsal | ||
DxeServicesLib | ||
DxeServicesTableLib | ||
DxeSmbusLib | ||
DxeTimerLibEsal | ||
PciSegmentLibSegmentInfo | ||
PeiCoreEntryPoint | ||
PeiDxePostCodeLibReportStatusCode | ||
PeiExtractGuidedSectionLib | ||
PeiHobLib | ||
PeiIoLibCpuIo | ||
PeiMemoryAllocationLib | ||
PeiMemoryLib | ||
PeiPalLib | ||
PeiPcdLib | ||
PeiPciLibPciCfg2 | ||
PeiPciSegmentLibPciCfg2 | ||
PeiResourcePublicationLib | ||
PeiServicesLib | ||
PeiServicesTablePointerLib | ||
PeiServicesTablePointerLibIdt | ||
PeiServicesTablePointerLibKr7 | ||
PeiSmbusLibSmbus2Ppi | ||
PeimEntryPoint | ||
SecPeiDxeTimerLibCpu | ||
SmiHandlerProfileLibNull | ||
SmmIoLib | ||
SmmIoLibSmmCpuIo2 | ||
SmmLibNull | ||
SmmMemLib | ||
SmmMemoryAllocationLib | ||
SmmPciExpressLib | ||
SmmPciLibPciRootBridgeIo | ||
SmmPeriodicSmiLib | ||
SmmServicesTableLib | ||
UefiApplicationEntryPoint | ||
UefiBootServicesTableLib | ||
UefiDebugLibConOut | ||
UefiDebugLibDebugPortProtocol | ||
UefiDebugLibStdErr | ||
UefiDevicePathLib | ||
UefiDevicePathLibDevicePathProtocol | ||
UefiDriverEntryPoint | ||
UefiFileHandleLib | ||
UefiLib | ||
UefiMemoryAllocationLib | ||
UefiMemoryLib | ||
UefiPalLib | ||
UefiPciLibPciRootBridgeIo | ||
UefiPciSegmentLibPciRootBridgeIo | ||
UefiRuntimeLib | ||
UefiRuntimeServicesTableLib | ||
UefiSalLib | ||
UefiScsiLib | ||
UefiUsbLib |