pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/digest/files digest: fix aliasing bug with gc...
details: https://anonhg.NetBSD.org/pkgsrc/rev/431e41b6af57
branches: trunk
changeset: 373909:431e41b6af57
user: mcf <mcf%pkgsrc.org@localhost>
date: Tue Feb 15 05:25:38 2022 +0000
description:
digest: fix aliasing bug with gcc 11
gcc 11 with -O2 optimizes away the store of the bit length into the
last 8 bytes of the context buffer due to an aliasing violation
(stored through uint64_t, retrieved through uint32_t).
To fix this, import the NetBSD patch from christos[0] which makes
it use memcpy instead.
[0] http://cvsweb.netbsd.org/bsdweb.cgi/src/common/lib/libc/hash/sha2/sha2.c.diff?r1=1.12&r2=1.13
diffstat:
pkgtools/digest/files/configure | 4 ++--
pkgtools/digest/files/sha2.c | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r f48e9e273e8f -r 431e41b6af57 pkgtools/digest/files/configure
--- a/pkgtools/digest/files/configure Mon Feb 14 22:22:48 2022 +0000
+++ b/pkgtools/digest/files/configure Tue Feb 15 05:25:38 2022 +0000
@@ -580,8 +580,8 @@
# Identity of this package.
PACKAGE_NAME='nbsd-digest'
PACKAGE_TARNAME='nbsd-digest'
-PACKAGE_VERSION='20211023'
-PACKAGE_STRING='nbsd-digest 20190127'
+PACKAGE_VERSION='20220214'
+PACKAGE_STRING='nbsd-digest 20220214'
PACKAGE_BUGREPORT='agc%netbsd.org@localhost'
PACKAGE_URL=''
diff -r f48e9e273e8f -r 431e41b6af57 pkgtools/digest/files/sha2.c
--- a/pkgtools/digest/files/sha2.c Mon Feb 14 22:22:48 2022 +0000
+++ b/pkgtools/digest/files/sha2.c Tue Feb 15 05:25:38 2022 +0000
@@ -548,7 +548,8 @@
*context->buffer = 0x80;
}
/* Set the bit count: */
- *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+ MEMCPY_BCOPY(&context->buffer[SHA256_SHORT_BLOCK_LENGTH],
+ &context->bitcount, sizeof(context->bitcount));
/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
Home |
Main Index |
Thread Index |
Old Index