-
Notifications
You must be signed in to change notification settings - Fork 52
Description
If the unit tests from test/libdigidoc_boost.cpp are run without a network connection, an attempted network connection to fails during a call to the TS constructor from within the DocSuite/signature<digidoc__ASiCE> test, leading to error messages and ultimately a segfault. (I found this while packaging qdigidoc4 for GNU Guix, where the build environment is restricted from network access and tests are run during the build if possible.)
The connection attempt occurs in the execution of BOOST_CHECK_NO_THROW(d->sign(&signer1)) on libdigidoc_boost.cpp:297, during a call to the TS constructor which tries to connect to http://demo.sk.ee/tsa/, and the segfault happens on line 344, when d->signatures().back() is called with signatures().size() == 0.
The network-dependent tests are DocSuite/files<digidoc__ASiCE>, DocSuite/signature<digidoc__ASiCE>, and DocSuite/signatureParameters<digidoc__ASiCE> (for the Guix package I'm skipping these with BOOST_TEST_RUN_FILTERS so that most of the tests can still be run).
I've attached a log of a test run and a gdb session, including backtraces for calls to connect and thrown exceptions. (Excluding throws from "exception raised as expected" checks, and a couple early connection attempts from getpwuid_r. The first two catchpoint hits are probably unrelated, too.)
Partial backtrace from the connect breakpoint:
#11 0x00007ffff7f76a24 in digidoc::Connect::Connect (this=this@entry=0x7fffffffcda0, _url=..., _method=..., _timeout=_timeout@entry=0, certs=..., userAgentData=...)
at /tmp/guix-build-libdigidocpp-4.1.0.drv-0/source/src/crypto/Connect.cpp:119
#12 0x00007ffff7f6d588 in digidoc::TS::TS (this=this@entry=0x7fffffffcf90, digest=..., userAgent=...)
at /tmp/guix-build-libdigidocpp-4.1.0.drv-0/source/src/crypto/TS.cpp:90
#13 0x00007ffff7f5d7ac in digidoc::SignatureXAdES_T::extendSignatureProfile (this=this@entry=0x51d340, signer=signer@entry=0x7fffffffd300)
at /tmp/guix-build-libdigidocpp-4.1.0.drv-0/source/src/SignatureXAdES_T.cpp:76
#14 0x00007ffff7f604ac in digidoc::SignatureXAdES_LT::extendSignatureProfile (this=this@entry=0x51d340, signer=signer@entry=0x7fffffffd300)
at /tmp/guix-build-libdigidocpp-4.1.0.drv-0/source/src/SignatureXAdES_LT.cpp:208
#15 0x00007ffff7f63a7c in digidoc::SignatureXAdES_LTA::extendSignatureProfile (this=this@entry=0x51d340, signer=signer@entry=0x7fffffffd300)
at /tmp/guix-build-libdigidocpp-4.1.0.drv-0/source/src/SignatureXAdES_LTA.cpp:106
#16 0x00007ffff7f190a2 in digidoc::ASiC_E::sign (this=0x58f110, signer=0x7fffffffd300) at /tmp/guix-build-libdigidocpp-4.1.0.drv-0/source/src/ASiC_E.cpp:267
#17 0x000000000047c128 in DocSuite::signature<digidoc::ASiCE>::test_method (this=<synthetic pointer>)
at /tmp/guix-build-libdigidocpp-4.1.0.drv-0/source/test/libdigidocpp_boost.cpp:297