[PATCH] D83742: [libunwind] Fix getSLEB128 on large values
    Ryan Prichard via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jul 15 19:14:16 PDT 2020
    
    
  
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfd802cc4dea4: [libunwind] Fix getSLEB128 on large values (authored by rprichard).
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83742/new/
https://reviews.llvm.org/D83742
Files:
  libunwind/src/AddressSpace.hpp
Index: libunwind/src/AddressSpace.hpp
===================================================================
--- libunwind/src/AddressSpace.hpp
+++ libunwind/src/AddressSpace.hpp
@@ -290,11 +290,11 @@
     if (p == pend)
       _LIBUNWIND_ABORT("truncated sleb128 expression");
     byte = *p++;
-    result |= ((byte & 0x7f) << bit);
+    result |= (uint64_t)(byte & 0x7f) << bit;
     bit += 7;
   } while (byte & 0x80);
   // sign extend negative numbers
-  if ((byte & 0x40) != 0)
+  if ((byte & 0x40) != 0 && bit < 64)
     result |= (-1ULL) << bit;
   addr = (pint_t) p;
   return result;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83742.278356.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200716/61435ccb/attachment.bin>
    
    
More information about the llvm-commits
mailing list