This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


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

Re: glibc-2.0.93: inlines for strstr on i486 badly broken


Horst von Brand <vonbrand@sleipnir.valparaiso.cl> writes:

> The string inlines for __strstr_g() are missing the initialization of %edi
> to __needle, so every use of them segfaults. There are also unnecesary
> initial values for the fourth argument.

Thanks, I used a bit different method but the result should be the same.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: string.h
===================================================================
RCS file: /egcs/carton/cvsfiles/libc/sysdeps/i386/i486/bits/string.h,v
retrieving revision 1.14
diff -d -u -p -r1.14 string.h
--- string.h	1998/05/08 12:32:17	1.14
+++ string.h	1998/05/20 04:11:04
@@ -1530,7 +1530,8 @@ __strstr_g (__const char *__haystack, __
      "2:\n\t"
      "popl	%%ebx"
      : "=a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
-     : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (0), "d" (__needle)
+     : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle),
+       "d" (__needle)
      : "cc");
   return __res;
 }
@@ -1558,7 +1559,8 @@ __strstr_g (__const char *__haystack, __
      "xorl	%%eax,%%eax\n"
      "2:"
      : "=a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=&d" (__d3)
-     : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (0), "b" (__needle)
+     : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle),
+       "b" (__needle)
      : "cc");
   return __res;
 }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I don't know what I thought when using 0...

-- Uli
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------


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