[PATCH] D97557: [PDB] Fix unsigned integer overflow

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 08:27:08 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG301551ae8e8f: [PDB] Fix unsigned integer overflow (authored by thakis).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97557/new/

https://reviews.llvm.org/D97557

Files:
  llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp


Index: llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
===================================================================
--- llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
+++ llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
@@ -156,7 +156,7 @@
   size_t RS = S2.size();
   // Shorter strings always compare less than longer strings.
   if (LS != RS)
-    return LS - RS;
+    return (LS > RS) - (LS < RS);
 
   // If either string contains non ascii characters, memcmp them.
   if (LLVM_UNLIKELY(!isAsciiString(S1) || !isAsciiString(S2)))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97557.326706.patch
Type: text/x-patch
Size: 551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210226/75aff4a0/attachment.bin>


More information about the llvm-commits mailing list