about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/netash/ash.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-05-25 05:13:41 -0700
committerH.J. Lu <hjl.tools@gmail.com>2024-05-27 07:38:56 -0700
commit9f2b100d6705b9bbb25206b53e80d7759644e06e (patch)
tree276f7860c1912bc914bd33883ac6398c71b6be0c /sysdeps/unix/sysv/linux/netash/ash.h
parentc7c3f5bf80ae86b34501f473f1a9fc545c911b7f (diff)
downloadglibc-9f2b100d6705b9bbb25206b53e80d7759644e06e.tar.gz
glibc-9f2b100d6705b9bbb25206b53e80d7759644e06e.tar.xz
glibc-9f2b100d6705b9bbb25206b53e80d7759644e06e.zip
parse_fdinfo: Don't advance pointer twice [BZ #31798]
pidfd_getpid.c has

      /* Ignore invalid large values.  */
      if (INT_MULTIPLY_WRAPV (10, n, &n)
          || INT_ADD_WRAPV (n, *l++ - '0', &n))
        return -1;

For GCC older than GCC 7, INT_ADD_WRAPV(a, b, r) is defined as

   _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW)

and *l++ - '0' is evaluated twice.  Fix BZ #31798 by moving "l++" out of
the if statement.  Tested with GCC 6.4 and GCC 14.1.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
(cherry picked from commit f981bf6b9db87e0732b46bfe92fdad4d363225e8)
Diffstat (limited to 'sysdeps/unix/sysv/linux/netash/ash.h')
0 files changed, 0 insertions, 0 deletions