]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix inline strncat/strncmp on x86
authorAndreas Schwab <schwab@redhat.com>
Thu, 4 Aug 2011 18:59:25 +0000 (14:59 -0400)
committerAndreas Schwab <schwab@redhat.com>
Fri, 5 Aug 2011 08:00:57 +0000 (10:00 +0200)
(cherry picked from commit 8c1a459f9a64abee69c154c8a0e5ab9be86256e4)

ChangeLog
sysdeps/i386/i486/bits/string.h

index 1c034b67921a2f49dc30b438560e7eaa88d807b0..2f637949836997620211fc934a0b43e6795f65d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-25  Andreas Schwab  <schwab@redhat.com>
+
+       * sysdeps/i386/i486/bits/string.h (__strncat_g): Correctly handle
+       __n bigger than INT_MAX+1.
+       (__strncmp_g): Likewise.
+
 2011-07-23  Ulrich Drepper  <drepper@gmail.com>
 
        * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix one more
index 9f05c7e655ec82652181e4cc65e17f4a8cc52e44..4f8c104feea9bc14567ab6644510b2ed314ed896 100644 (file)
@@ -1,6 +1,6 @@
 /* Optimized, inlined string functions.  i486 version.
-   Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004,2007
-       Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004,2007,2011
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -1058,8 +1058,8 @@ __strncat_g (char *__dest, __const char __src[], size_t __n)
      "movl %4, %3\n\t"
      "decl %1\n\t"
      "1:\n\t"
-     "decl     %3\n\t"
-     "js       2f\n\t"
+     "subl     $1,%3\n\t"
+     "jc       2f\n\t"
      "movb     (%2),%b0\n\t"
      "movsb\n\t"
      "testb    %b0,%b0\n\t"
@@ -1078,8 +1078,8 @@ __strncat_g (char *__dest, __const char __src[], size_t __n)
      "leal     1(%1),%1\n\t"
      "jne      1b\n"
      "2:\n\t"
-     "decl     %3\n\t"
-     "js       3f\n\t"
+     "subl     $1,%3\n\t"
+     "jc       3f\n\t"
      "movb     (%2),%b0\n\t"
      "leal     1(%2),%2\n\t"
      "movb     %b0,(%1)\n\t"
@@ -1219,8 +1219,8 @@ __strncmp_g (__const char *__s1, __const char *__s2, size_t __n)
   register int __res;
   __asm__ __volatile__
     ("1:\n\t"
-     "decl     %3\n\t"
-     "js       2f\n\t"
+     "subl     $1,%3\n\t"
+     "jc       2f\n\t"
      "movb     (%1),%b0\n\t"
      "incl     %1\n\t"
      "cmpb     %b0,(%2)\n\t"