botan
botan copied to clipboard
[2.19.4] Sporadic test failure with `_GLIBCXX_ASSERTIONS`
Hi all!
When running tests for Botan 2.19.4 when packaging for Gentoo, I got:
bcrypt:
bcrypt ran 380 tests in 2.33 sec all ok
bcrypt_pbkdf:
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/stl_vector.h:1127: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = Botan::secure_allocator<unsigned char>; reference = unsigned char&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)
It only happens on some runs, unfortunately.
Backtraces (hit this with gcc 13 too):
Core was generated by `./botan-test2 --test-threads=32'.
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f403f2bec7c in ?? () from /usr/lib64/libc.so.6
[Current thread is 1 (Thread 0x7f4032a136c0 (LWP 2878430))]
(gdb) bt
#0 0x00007f403f2bec7c in ?? () from /usr/lib64/libc.so.6
#1 0x00007f403f268fc2 in raise () from /usr/lib64/libc.so.6
#2 0x00007f403f2514f2 in abort () from /usr/lib64/libc.so.6
#3 0x00007f403f4e4dfb in std::__glibcxx_assert_fail (file=file@entry=0x7f403fdac4f0 "/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/stl_vector.h", line=line@entry=1127,
function=function@entry=0x7f403fdacee0 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = Botan::secure_allocator<unsigned char>; reference = unsigned char&; size_type = "..., condition=condition@entry=0x7f403fda401a "__n < this->size()")
at /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/libstdc++-v3/src/c++11/assert_fail.cc:41
#4 0x00007f403fca9eff in std::vector<unsigned char, Botan::secure_allocator<unsigned char> >::operator[] (this=<optimized out>, __n=<optimized out>)
at /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/stl_vector.h:1127
#5 Botan::TLS::TLS_CBC_HMAC_AEAD_Encryption::finish (this=0x7f3fc804b580, buffer=std::vector of length 0, capacity 0, offset=5) at src/lib/tls/tls_cbc/tls_cbc.cpp:207
#6 0x000055b54d1981c0 in ?? ()
#7 0x00007f4032a136c0 in ?? ()
#8 0x0000000000000001 in ?? ()
#9 0x0000000000000000 in ?? ()
#0 0x00007f2c660bec7c in ?? () from /usr/lib64/libc.so.6
#1 0x00007f2c66068fc2 in raise () from /usr/lib64/libc.so.6
#2 0x00007f2c660514f2 in abort () from /usr/lib64/libc.so.6
#3 0x00007f2c662e4dfb in std::__glibcxx_assert_fail (file=file@entry=0x7f2c66ba7578 "/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_vector.h", line=line@entry=1125,
function=function@entry=0x7f2c66ba7f68 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = Botan::secure_allocator<unsigned char>; reference = unsigned char&; size_type = "..., condition=condition@entry=0x7f2c66b9f000 "__n < this->size()")
at /usr/src/debug/sys-devel/gcc-14.0.9999/gcc-14.0.9999/libstdc++-v3/src/c++11/assert_fail.cc:41
#4 0x00007f2c66a9f0df in std::vector<unsigned char, Botan::secure_allocator<unsigned char> >::operator[] (__n=<optimized out>, this=<optimized out>)
at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/stl_vector.h:1125
#5 Botan::TLS::TLS_CBC_HMAC_AEAD_Encryption::finish (this=0x7f2c661f7b50, buffer=std::vector of length 5, capacity 10240 = {...}, offset=5) at src/lib/tls/tls_cbc/tls_cbc.cpp:207
#6 0x000055e4428366f0 in ?? ()
#7 0x00007f2c5f01e6c0 in ?? ()
#8 0x0000000000000001 in ?? ()
#9 0x0000000000000000 in ?? ()
See also https://github.com/randombit/botan/issues/3623, https://github.com/randombit/botan/pull/3736, and https://github.com/randombit/botan/issues/3737.