1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/lib/DebugInfo
Nico Weber 0a5bf9f615 [PDB] Fix unsigned integer overflow
When building with -fsanitize=unsigned-integer-overflow, this code
causes a diagnostic like:

    ../../llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp:159:15:
    runtime error: unsigned integer overflow:
    90 - 229 cannot be represented in type 'unsigned long'

unsigned integer overflow is well defined and it isn't an issue in
practice, but in obscure scenarios (S1.size() small, S2.size over 2GB
on 32-bit systems) it could even be a bug.

So use the usual idiom for implementing cmp functions instead of the
gernally considered buggy idiom :)
See e.g. https://www.gnu.org/software/libc/manual/html_node/Comparison-Functions.html
or https://stackoverflow.com/questions/10996418/efficient-integer-compare-function/10997428#10997428

Differential Revision: https://reviews.llvm.org/D97557
2021-02-26 11:26:53 -05:00
..
CodeView [llvm] Use llvm::sort (NFC) 2021-01-17 10:39:45 -08:00
DWARF llvm-dwarfdump: fix the counting when printing DW_OP_entry_value 2021-02-11 11:17:04 -08:00
GSYM [llvm] Use llvm::sort (NFC) 2021-01-17 10:39:45 -08:00
MSF [DebugInfo] Use llvm::append_range (NFC) 2021-01-04 11:42:45 -08:00
PDB [PDB] Fix unsigned integer overflow 2021-02-26 11:26:53 -05:00
Symbolize DebugInfo/Symbolize: Exclude ARM mapping symbols for .symtab symbolization after D95916 2021-02-12 11:04:20 -08:00
CMakeLists.txt