[PATCH] Moar string interceptors: strstr, strcasestr, strcspn, strpbrk

Alexander Potapenko glider at google.com
Fri Dec 26 00:54:27 PST 2014


================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:2401
@@ -2310,1 +2400,3 @@
 
+UNUSED static inline bool IsValidStrtolBase(int base) {
+  return (base == 0) || (2 <= base && base <= 36);
----------------
m.guseva wrote:
> glider wrote:
> > I suggest putting the UNUSED function under the #ifdef below and remove the UNUSED attribute.
> These functions were moved from asan_interceptors.cc source where they are used in strtol-related interceptors. Some of them(strtol\atoi\atol) are not under any if directive. Is there any better place where to put this helpers to be shared by asan and common interceptors?
Oh, sorry, I've missed that.
It's fine to keep these functions as is (I still think IsValidStrtolBase is unnecessary and can be removed)

================
Comment at: lib/sanitizer_common/sanitizer_flags.cc:167
@@ -162,1 +166,3 @@
       "default and for sanitizers that don't reserve lots of virtual memory.");
+  ParseFlag(str, &f->replace_strstr, "replace_strstr", "If set, uses custom "
+       "wrappers for strstr and strcasestr functions to find more errors.");
----------------
m.guseva wrote:
> glider wrote:
> > I think we need to be consistent in naming the flags that disable interceptors.
> > There's already "intercept_tls_get_addr", so we either need to change it (no need to do that in this CL) or rename your flags into "intercept_something".
> > (Note that "intrin" in "replace_intrin" isn't a function name, so you don't need to be consistent with that).
> The "replace_" flags were suggested in original issue. I agree it should be aligned with existing one. 
Let's see what Kostya and Alexey think.

http://reviews.llvm.org/D6056

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list