This repository was archived by the owner on Jan 26, 2026. It is now read-only.
Commit 59b2504
committed
kdf: fix unaligned memory access in balloon_xor_block
* cipher/kdf.c (balloon_xor_block): Use 'buf_xor' helper function; Change
pointer parameters to 'void *' type.
(balloon_final): Don't cast last_block to 'u64 *' for balloon_xor_block
call.
--
Seen on s390x UBSAN:
/home/testbuild/libgcrypt/cipher/kdf.c:1130:12: runtime error: load of misaligned address 0x00400181370c for type 'u64', which requires 8 byte alignment
0x00400181370c: note: pointer points here
01 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
#0 0x4001a3f3d3 (/run/user/1006/libgcrypt/build_s390x-linux-gnu_ubsan/src/.libs/libgcrypt.so.20+0x1f83d3)
#1 0x40019cf049 (/run/user/1006/libgcrypt/build_s390x-linux-gnu_ubsan/src/.libs/libgcrypt.so.20+0x188049)
#2 0x400000acbf (/run/user/1006/libgcrypt/build_s390x-linux-gnu_ubsan/tests/t-kdf+0xacbf)
#3 0x4000008931 (/run/user/1006/libgcrypt/build_s390x-linux-gnu_ubsan/tests/t-kdf+0x8931)
#4 0x400271a031 (/lib/libc.so.6+0x2b031)
#5 0x400271a10d (/lib/libc.so.6+0x2b10d)
#6 0x4000009bcf (/run/user/1006/libgcrypt/build_s390x-linux-gnu_ubsan/tests/t-kdf+0x9bcf)
GnuPG-bug-id: 5817
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>1 parent 26bfa41 commit 59b2504
1 file changed
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1122 | 1122 | | |
1123 | 1123 | | |
1124 | 1124 | | |
1125 | | - | |
| 1125 | + | |
1126 | 1126 | | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
| 1127 | + | |
1131 | 1128 | | |
1132 | 1129 | | |
1133 | 1130 | | |
| |||
1355 | 1352 | | |
1356 | 1353 | | |
1357 | 1354 | | |
1358 | | - | |
| 1355 | + | |
1359 | 1356 | | |
1360 | 1357 | | |
1361 | 1358 | | |
| |||
0 commit comments