]> Savannah Git Hosting - gnulib.git/commitdiff
memchr: Work around memory overrun bug on AIX 7.2.
authorBruno Haible <bruno@clisp.org>
Fri, 11 Dec 2020 11:14:03 +0000 (12:14 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 11 Dec 2020 11:14:03 +0000 (12:14 +0100)
* m4/memchr.m4 (gl_FUNC_MEMCHR): Test against AIX 7.2 bug.
* doc/posix-functions/memchr.texi: Mention the AIX bug.

ChangeLog
doc/posix-functions/memchr.texi
m4/memchr.m4

index 9d72635863e4995ada85c41bdca96a4487398f9e..ec3be42f92544496dffa820ddc90daecf5246d71 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-11  Bruno Haible  <bruno@clisp.org>
+
+       memchr: Work around memory overrun bug on AIX 7.2.
+       * m4/memchr.m4 (gl_FUNC_MEMCHR): Test against AIX 7.2 bug.
+       * doc/posix-functions/memchr.texi: Mention the AIX bug.
+
 2020-12-11  Bruno Haible  <bruno@clisp.org>
 
        execute-tests: Fix compilation error on AIX in 32-bit mode.
index 5ceb71fd642e410e7b2b9108602880461df27092..98ef20ec6a2195f896b11b293738724df7e39d54 100644 (file)
@@ -10,7 +10,7 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This function dereferences too much memory on some platforms:
-glibc 2.10 on x86_64, IA-64; glibc 2.11 on Alpha.
+glibc 2.10 on x86_64, IA-64; glibc 2.11 on Alpha, AIX 7.2.
 @item
 This function returns NULL if the character argument is not in the range
 of an @code{unsigned char} on some platforms:
index 81e8f985df43c9967b23b00c366475f4a3d543f5..888d2b25622b121166f9b345d853444b0f06d764 100644 (file)
@@ -1,4 +1,4 @@
-# memchr.m4 serial 16
+# memchr.m4 serial 17
 dnl Copyright (C) 2002-2004, 2009-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -59,6 +59,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
 #endif
   if (fence)
     {
+      /* Test against bugs on glibc systems.  */
       if (memchr (fence, 0, 0))
         result |= 1;
       strcpy (fence - 9, "12345678");
@@ -66,6 +67,9 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
         result |= 2;
       if (memchr (fence - 1, 0, 3) != fence - 1)
         result |= 4;
+      /* Test against bug on AIX 7.2.  */
+      if (memchr (fence - 4, '6', 16) != fence - 4)
+        result |= 8;
     }
   /* Test against bug on Android 4.3.  */
   {
@@ -74,7 +78,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
     input[1] = 'b';
     input[2] = 'c';
     if (memchr (input, 0x789abc00 | 'b', 3) != input + 1)
-      result |= 8;
+      result |= 16;
   }
   return result;
 ]])],