libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libunwind] [patch] Handle strings that aren't NULL terminated


From: David Mosberger
Subject: Re: [libunwind] [patch] Handle strings that aren't NULL terminated
Date: Fri, 18 Jun 2004 23:13:33 -0700

>>>>> On Fri, 18 Jun 2004 14:23:15 -0400, "Ed Connell" <address@hidden> said:

  Ed> Intel's icc produces strings that aren't NULL terminated which
  Ed> causes a crash in libunwind.  Here's a fix.

I don't see how this could happen.  Do you have a concrete example?

Note: there was a related/similar bug reported by Mark Young which
should be fixed by the attached problem (though I never seem to have
gotten confirmation of that, now that you remind me of it).

Does the attached patch fix the problem for you?

Thanks,

        --david

===== src/os-linux.h 1.5 vs edited =====
--- 1.5/src/os-linux.h  Wed Apr 21 00:24:34 2004
+++ edited/src/os-linux.h       Wed Jun  9 16:01:47 2004
@@ -139,9 +139,12 @@
 
   while (1)
     {
-      digit = *cp++;
+      digit = *cp;
       if ((digit - '0') <= 9)
-       digit -= '0';
+       {
+         digit -= '0';
+         ++cp;
+       }
       else
        break;
       val = (10 * val) + digit;
@@ -159,7 +162,11 @@
   if (!cp)
     return NULL;
 
-  *valp = *cp++;
+  *valp = *cp;
+
+  /* don't step over NUL terminator */
+  if (*cp)
+    ++cp;
   return cp;
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]