]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Intercept and replace calls to calls to strnlen in glibc, for the
authorJulian Seward <jseward@acm.org>
Mon, 26 Jan 2009 00:06:43 +0000 (00:06 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 26 Jan 2009 00:06:43 +0000 (00:06 +0000)
usual reasons.  Also update an expected output (lines numbers in
h_intercepts.c should be removed by the regtest system, really).

--> 3_4_BRANCH

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9060

exp-ptrcheck/h_intercepts.c
exp-ptrcheck/tests/bad_percentify.stderr.exp-glibc28-amd64

index 48819d4c6f2a9e7d0102028141a4d7c386016061..3ae8c6222ed0b88c6e5f2d0a3b82c1d6601d3f04 100644 (file)
 
 
 
+#define STRNLEN(soname, fnname) \
+   SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ); \
+   SizeT VG_REPLACE_FUNCTION_ZU(soname,fnname) ( const char* str, SizeT n ) \
+   { \
+      SizeT i = 0; \
+      while (i < n && str[i] != 0) i++; \
+      return i; \
+   }
+
+STRNLEN(m_libc_soname, strnlen)
+
+
 // Note that this replacement often doesn't get used because gcc inlines
 // calls to strlen() with its own built-in version.  This can be very
 // confusing if you aren't expecting it.  Other small functions in this file
index 01c0b9fe4aaef3142a19a49287879a70ae0851a6..572da507d3585a203f86dd43f0f0f7e5f31edeb5 100644 (file)
@@ -1,6 +1,6 @@
 
 Invalid read of size 1
-   at 0x........: strlen (h_intercepts.c:85)
+   at 0x........: strlen (h_intercepts.c:97)
    by 0x........: ...
    by 0x........: ...
    by 0x........: VG_print_translation_stats (bad_percentify.c:88)
@@ -10,7 +10,7 @@ Invalid read of size 1
  Actual:   unknown
 
 Invalid read of size 1
-   at 0x........: strlen (h_intercepts.c:85)
+   at 0x........: strlen (h_intercepts.c:97)
    by 0x........: ...
    by 0x........: ...
    by 0x........: VG_print_translation_stats (bad_percentify.c:93)
@@ -20,7 +20,7 @@ Invalid read of size 1
  Actual:   unknown
 
 Invalid read of size 1
-   at 0x........: strlen (h_intercepts.c:85)
+   at 0x........: strlen (h_intercepts.c:97)
    by 0x........: ...
    by 0x........: ...
    by 0x........: VG_print_translation_stats (bad_percentify.c:98)