open-eid / DigiDoc4-Client

DigiDoc4 is an application for digitally signing and encrypting documents; the software includes functionality to manage Estonian ID-card - change pin codes etc.
https://www.id.ee/en/article/install-id-software/
Other
119 stars 42 forks source link

Crash when compiled with GLIBCXX_ASSERTIONS #1144

Closed zketas closed 1 year ago

zketas commented 1 year ago

when compiled with CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS" qdigidoc4 crashes on reading the ID card qt6.4.1 glibc2.36 gcc12.2.0

"3BDB960080B1FE451F830012233F536549440F9000F1"
/usr/include/c++/12.2.0/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>; reference = long unsigned int&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

Thread 4 "QSigner" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffebde96c0 (LWP 112995)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff5dc56b3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff5d75958 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff5d5f53d in __GI_abort () at abort.c:79
#4  0x00007ffff6016112 in std::__glibcxx_assert_fail(char const*, int, char const*, char const*)
(file=file@entry=0x5555556e7440 "/usr/include/c++/12.2.0/bits/stl_vector.h", line=line@entry=1123, function=function@entry=0x5555556ead50 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>; reference = long unsigned int&; size_type"..., condition=condition@entry=0x5555556eb14c "__n < this->size()") at /usr/src/debug/gcc/libstdc++-v3/src/c++11/debug.cc:60
#5  0x0000555555608f5b in std::vector<unsigned long, std::allocator<unsigned long> >::operator[](unsigned long) (this=<optimized out>, __n=<optimized out>)
at /usr/include/c++/12.2.0/bits/stl_vector.h:1121
#6  std::vector<unsigned long, std::allocator<unsigned long> >::operator[](unsigned long) (__n=0, this=0x7fffebde8860) at /usr/include/c++/12.2.0/bits/stl_vector.h:1121
#7  QPKCS11::tokens() const (this=0x555555bdc870) at ./qdigidoc4-4.2.14.4431/client/QPKCS11.cpp:332
#8  0x00005555556100dc in QSigner::run() (this=0x555555baa370) at ./qdigidoc4-4.2.14.4431/client/QSigner.cpp:311
#9  0x00007ffff6402af1 in operator() (__closure=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.1/src/corelib/thread/qthread_unix.cpp:321
#10 (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=<optimized out>)
at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.1/src/corelib/thread/qthread_unix.cpp:257
#11 QThreadPrivate::start(void*) (arg=0x555555baa370) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.4.1/src/corelib/thread/qthread_unix.cpp:280
#12 0x00007ffff5dc38fd in start_thread (arg=<optimized out>) at pthread_create.c:442
#13 0x00007ffff5e45a60 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
metsma commented 1 year ago

Can you test PR

zketas commented 1 year ago

confirmed fixed