octave-dicom: shared usage of dicomdict across plugins results in crash on program exit

Bug #2069660 reported by Dan Bungert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-13 (Ubuntu)
Invalid
Undecided
Unassigned
octave-dicom (Debian)
Confirmed
Unknown
octave-dicom (Ubuntu)
Fix Released
Undecided
Dan Bungert

Bug Description

dicomdict is both functionality provided as a .oct file but also code that is shared among other .oct files (dicominfo.oct dicomwrite.oct dicomlookup.oct dicomdisp.oct dicomanon.oct)

programs which use any two of these, including the built-in test suite for octave-dicom, may experience a crash-on-exit.

This is due to the following lines from octave-dicom src/Makefile.in:
```
need_dict = dicominfo.oct dicomwrite.oct dicomlookup.oct dicomdisp.oct dicomanon.oct
...
$(need_dict): %.oct: %.cpp dicomdict.o
        $(MKOCTFILE) $(GDCM_CPPFLAGS) $(GDCM_LIBS) $^
```

The result of this is that dicomdict.o symbols are present in multiple plugins, and the resulting program cleanup from this situation can go poorly, with errors such as "double free or corruption (!prev)" and other errors that you would expect to see with a corrupted heap.

If dlopen() order could be dictated so that the need_dict libs first had dicomdict.oct loaded first, paired with the "need_dict" plugins no longer being built with dicomdict.o, then octave programs using octave-dicom would be ok. It's not currently clear to me how that dlopen() order would be dictated.

original description follows
---

octave-dicom is currently FTBFS on all non-riscv64 arches, due to test failures. A double-free is happening, which causes a crash and fails the test suite.

Backporting this source to Ubuntu Mantic with modest packaging changes (reduce required dh-octave version) will pass the test suite.

https://launchpadlibrarian.net/735078455/buildlog_ubuntu-oracular-amd64.octave-dicom_0.6.0-3build1_BUILDING.txt.gz

5 tests, 5 passed, 0 known failure, 0 skipped
double free or corruption (!prev)
fatal: caught signal Aborted -- stopping myself...
Aborted (core dumped)
make: *** [debian/rules:5: binary] Error 134
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

Tags: ftbfs
Revision history for this message
Dan Bungert (dbungert) wrote :

I believe this to be a blocking issue for gcc-13, as britney wants to migrate both gcc-13 and octave-dicom at the same time (along with many other source packages).

summary: - FTBFS on !riscv64 due to test failure
+ octave-dicom FTBFS on !riscv64 due to test failure
Dan Bungert (dbungert)
summary: - octave-dicom FTBFS on !riscv64 due to test failure
+ octave-dicom: shared usage of dicomdict across plugins results in crash
+ on program exit
Changed in gcc-13 (Ubuntu):
status: New → Invalid
Dan Bungert (dbungert)
description: updated
Dan Bungert (dbungert)
Changed in octave-dicom (Ubuntu):
status: New → In Progress
assignee: nobody → Dan Bungert (dbungert)
Dan Bungert (dbungert)
Changed in octave-dicom (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package octave-dicom - 0.6.0-3ubuntu1

---------------
octave-dicom (0.6.0-3ubuntu1) oracular; urgency=medium

  * Fix a use-after-free issue related to duplicated symbols in plugins
    that reference dicomdict functionality (dicomdict, dicominfo, dicomwrite,
    dicomlookup, dicomdisp, dicomanon) (LP: #2069660)

 -- Dan Bungert <email address hidden> Fri, 28 Jun 2024 17:04:25 -0600

Changed in octave-dicom (Ubuntu):
status: Fix Committed → Fix Released
Changed in octave-dicom (Debian):
status: Unknown → New
Revision history for this message
Dan Bungert (dbungert) wrote :
Changed in octave-dicom (Debian):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.