This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa mudflap] libmudflap hook functions
- From: graydon at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 14 Aug 2002 11:57:15 -0400
- Subject: [tree-ssa mudflap] libmudflap hook functions
- Reply-to: graydon at redhat dot com
Just committed:
[ libmudflap/ChangeLog ]
2002-08-14 Graydon Hoare <graydon@redhat.com>
* mf-hooks.c: Change __real_strlen() to __real_strlen()+1 when
verifying non-size-limited string extents.
Index: libmudflap/mf-hooks.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-hooks.c,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 mf-hooks.c
--- libmudflap/mf-hooks.c 14 Aug 2002 15:42:27 -0000 1.1.2.4
+++ libmudflap/mf-hooks.c 14 Aug 2002 15:53:57 -0000
@@ -117,7 +117,6 @@
__mf_check ((unsigned)value, size); \
}
-
void *
__wrap_memcpy (void *dest, const void *src, size_t n)
{
@@ -247,8 +246,8 @@
extern int __real_strcmp (const char *s1, const char *s2);
int s1_sz = __real_strlen (s1);
int s2_sz = __real_strlen (s2);
- MF_VALIDATE_EXTENT(s1, s1_sz);
- MF_VALIDATE_EXTENT(s2, s2_sz);
+ MF_VALIDATE_EXTENT(s1, s1_sz+1);
+ MF_VALIDATE_EXTENT(s2, s2_sz+1);
return __real_strcmp (s1, s2);
}
@@ -258,8 +257,8 @@
extern int __real_strcasecmp (const char *s1, const char *s2);
int s1_sz = __real_strlen (s1);
int s2_sz = __real_strlen (s2);
- MF_VALIDATE_EXTENT(s1, s1_sz);
- MF_VALIDATE_EXTENT(s2, s2_sz);
+ MF_VALIDATE_EXTENT(s1, s1_sz+1);
+ MF_VALIDATE_EXTENT(s2, s2_sz+1);
return __real_strcasecmp (s1, s2);
}
@@ -291,7 +290,7 @@
extern char *__real_strdup (const char *s);
int n = __real_strlen (s);
char *result;
- MF_VALIDATE_EXTENT(s, n);
+ MF_VALIDATE_EXTENT(s, n+1);
result = __real_strdup (s);
__mf_register ((uintptr_t) result, n, __MF_TYPE_HEAP, "strdup region");
return result;
@@ -315,7 +314,7 @@
{
extern char *__real_strchr (const char *s, int c);
int n = __real_strlen (s);
- MF_VALIDATE_EXTENT(s, n);
+ MF_VALIDATE_EXTENT(s, n+1);
return __real_strchr (s, c);
}
@@ -324,7 +323,7 @@
{
extern char *__real_strrchr (const char *s, int c);
int n = __real_strlen (s);
- MF_VALIDATE_EXTENT(s, n);
+ MF_VALIDATE_EXTENT(s, n+1);
return __real_strrchr (s, c);
}
@@ -335,8 +334,8 @@
extern char *__real_strstr (const char *haystack, const char *needle);
int haystack_sz = __real_strlen (haystack);
int needle_sz = __real_strlen (needle);
- MF_VALIDATE_EXTENT(haystack, haystack_sz);
- MF_VALIDATE_EXTENT(needle, needle_sz);
+ MF_VALIDATE_EXTENT(haystack, haystack_sz+1);
+ MF_VALIDATE_EXTENT(needle, needle_sz+1);
return __real_strstr (haystack, needle);
}
@@ -357,7 +356,7 @@
{
extern int __real_strlen (const char *s);
int n = __real_strlen (s);
- MF_VALIDATE_EXTENT(s, n);
+ MF_VALIDATE_EXTENT(s, n+1);
return n;
}
@@ -401,7 +400,7 @@
{
extern char *__real_index (const char *s, int c);
int n = __real_strlen (s);
- MF_VALIDATE_EXTENT(s, n);
+ MF_VALIDATE_EXTENT(s, n+1);
return __real_index (s, c);
}
@@ -410,7 +409,7 @@
{
extern char *__real_rindex (const char *s, int c);
int n = __real_strlen (s);
- MF_VALIDATE_EXTENT(s, n);
+ MF_VALIDATE_EXTENT(s, n+1);
return __real_rindex (s, c);
}
@@ -435,6 +434,5 @@
/* }}} */
-
/* ------------------------------------------------------------------------ */
Index: libmudflap/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/ChangeLog,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 ChangeLog
--- libmudflap/ChangeLog 14 Aug 2002 15:42:27 -0000 1.1.2.5
+++ libmudflap/ChangeLog 14 Aug 2002 15:53:57 -0000
@@ -1,3 +1,8 @@
+2002-08-14 Graydon Hoare <graydon@redhat.com>
+
+ * mf-hooks.c: Change __real_strlen() to __real_strlen()+1 when
+ verifying non-size-limited string extents.
+
2002-08-14 Frank Ch. Eigler <fche@redhat.com>
* mf-hooks.c: Make __wrap string* functions use __real_str[n]len