Skip to content

dcmnet: copy alwaysAcceptDefaultRole_ in DcmAssociationConfiguration copy/assign - #168

Closed
lauyeehow1986-hub wants to merge 1 commit into
DCMTK:masterfrom
lauyeehow1986-hub:fix/dcmnet-dcasccfg-copy-default-role
Closed

lauyeehow1986-hub wants to merge 1 commit into
DCMTK:masterfrom
lauyeehow1986-hub:fix/dcmnet-dcasccfg-copy-default-role

Conversation

@lauyeehow1986-hub

Copy link
Copy Markdown

Summary

Fixes an uninitialized OFBool member (alwaysAcceptDefaultRole_) in DcmAssociationConfiguration's copy constructor and missing copy in DcmAssociationConfiguration::operator=.

Problem & Root Cause

Running DCMTK's test suite under Clang ASan + UBSan (-fsanitize=address,undefined) on master (e8d3d701) fails test 301 - dcmtls_scp_pool_tls:

dcmnet/libsrc/dcasccfg.cc:556:63: runtime error: load of value 190, which is not a valid value for type 'OFBool' (aka 'bool')
    #0 in DcmAssociationConfiguration::evaluateAssociationParameters(char const*, T_ASC_Association&) const dcmnet/libsrc/dcasccfg.cc:556:63
    #1 in DcmSCPConfig::evaluateIncomingAssociation(T_ASC_Association&) const dcmnet/libsrc/scpcfg.cc:109:24
    #2 in DcmSCP::negotiateAssociation() dcmnet/libsrc/scp.cc:566:33
    #3 in DcmSCP::processAssociationRQ() dcmnet/libsrc/scp.cc:515:12
    #4 in DcmThreadSCP::run(T_ASC_Association*) dcmnet/libsrc/scpthrd.cc:79:24
  1. DcmAssociationConfiguration::DcmAssociationConfiguration(const DcmAssociationConfiguration& arg) (dcmnet/libsrc/dcasccfg.cc) omitted alwaysAcceptDefaultRole_(arg.alwaysAcceptDefaultRole_) from its member initializer list, leaving alwaysAcceptDefaultRole_ uninitialized whenever a DcmAssociationConfiguration (or DcmSCPConfig) was copy-constructed (e.g., when DcmSCPPool constructs worker DcmThreadSCP instances).
  2. DcmAssociationConfiguration::operator=(const DcmAssociationConfiguration& arg) called this->clear() (resetting alwaysAcceptDefaultRole_ to OFFalse) and omitted alwaysAcceptDefaultRole_ = arg.alwaysAcceptDefaultRole_;.

Changes

  • dcmnet/libsrc/dcasccfg.cc:
    • Initialize alwaysAcceptDefaultRole_(arg.alwaysAcceptDefaultRole_) in the copy constructor.
    • Copy alwaysAcceptDefaultRole_ = arg.alwaysAcceptDefaultRole_; in operator=.
  • dcmnet/tests/tparseassoc.cc & dcmnet/tests/tests.cc:
    • Added and registered OFTEST(dcmnet_assoc_cfg_copy_alwaysAcceptDefaultRole) verifying both default (OFFalse) initialization/preservation and explicit OFTrue preservation across copy construction and copy assignment.

Verification

Built on Ubuntu 24.04 with Clang (-fsanitize=address,undefined, LSan enabled, -DDCMTK_ENABLE_CXX11=ON, -DDCMTK_DEFAULT_DICT=builtin):

  • ctest --output-on-failure: 551/551 tests passed (100%), including dcmtls_scp_pool_tls and dcmnet_assoc_cfg_copy_alwaysAcceptDefaultRole.

@michaelonken

Copy link
Copy Markdown
Member

Thank you for the report :) I just merged it into our internal testing branch. The fix will be visible within the next few days on public master branch.

@michaelonken

Copy link
Copy Markdown
Member

FYI: Issue in DCMTK bug tracker: https://support.dcmtk.org/redmine/issues/1309

michaelonken added a commit that referenced this pull request Nov 23, 2026
The copy constructor of DcmAssociationConfiguration did not initialize
alwaysAcceptDefaultRole_ and the copy assignment operator did not copy
it. This affected, e.g., all workers of an SCP pool.

Thanks to GitHub user "lauyeehow1986-hub" for the report and pull
request.

This closes GitHub PR #168 and DCMTK issue #1309.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants