[PATCH] D51106: Introduce new type for inteceptors UINTMAX_T

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 22 08:39:26 PDT 2018


krytarowski created this revision.
krytarowski added reviewers: vitalybuka, kcc, joerg.
krytarowski added a project: Sanitizers.
Herald added subscribers: llvm-commits, kubamracek.

The UINTMAX_T type will be used in new interceptors.

While there, correct the type of strtoumax(3) from INTMAX_T to UINTMAX_T.

Original patch from Yang Zheng.


Repository:
  rL LLVM

https://reviews.llvm.org/D51106

Files:
  lib/interception/interception.h
  lib/sanitizer_common/sanitizer_common_interceptors.inc


Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -3345,14 +3345,14 @@
   return res;
 }
 
-INTERCEPTOR(INTMAX_T, strtoumax, const char *nptr, char **endptr, int base) {
+INTERCEPTOR(UINTMAX_T, strtoumax, const char *nptr, char **endptr, int base) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, strtoumax, nptr, endptr, base);
   // FIXME: under ASan the call below may write to freed memory and corrupt
   // its metadata. See
   // https://github.com/google/sanitizers/issues/321.
   char *real_endptr;
-  INTMAX_T res = REAL(strtoumax)(nptr, &real_endptr, base);
+  UINTMAX_T res = REAL(strtoumax)(nptr, &real_endptr, base);
   StrtolFixAndCheck(ctx, nptr, endptr, real_endptr, base);
   return res;
 }
Index: lib/interception/interception.h
===================================================================
--- lib/interception/interception.h
+++ lib/interception/interception.h
@@ -29,6 +29,7 @@
 typedef __sanitizer::sptr    SSIZE_T;
 typedef __sanitizer::sptr    PTRDIFF_T;
 typedef __sanitizer::s64     INTMAX_T;
+typedef __sanitizer::u64     UINTMAX_T;
 typedef __sanitizer::OFF_T   OFF_T;
 typedef __sanitizer::OFF64_T OFF64_T;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51106.161971.patch
Type: text/x-patch
Size: 1345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180822/e4623934/attachment.bin>


More information about the llvm-commits mailing list