This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: bounds violation in cppmacro.c

I can't tell if this was consciously done in order to sometimes
avoid a comparison instruction, or if it was unconscious.  In any
case, it causes (spurious) bounds violation traps.


2000-09-15  Greg McGary  <>

	* cppmacro.c (check_trad_stringification): Check token
	text pointers against limit before dereferencing.

Index: cppmacro.c
RCS file: /cvs/gcc/egcs/gcc/cppmacro.c,v
retrieving revision 1.10
diff -u -p -r1.10 cppmacro.c
--- cppmacro.c	2000/09/10 03:41:49	1.10
+++ cppmacro.c	2000/09/15 18:44:55
@@ -645,11 +645,11 @@ check_trad_stringification (pfile, info,
       const cpp_token *token;
       /* Find the start of an identifier.  */
-      while (!is_idstart (*p) && p < limit) p++;
+      while (p < limit && !is_idstart (*p)) p++;
       /* Find the end of the identifier.  */
       q = p;
-      while (is_idchar (*q) && q < limit) q++;
+      while (q < limit && is_idchar (*q)) q++;
       /* Loop over the function macro arguments to see if the
 	 identifier inside the string matches one of them.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]