bugGNU Octave - Bugs: bug #38159, dicom package: crash on calling...

 
 

bug #38159: dicom package: crash on calling dicomwrite function

Submitter:  None
Submitted:  Thu 24 Jan 2013 04:21:33 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  lostbard
Originator Name:  Chen Xinjia Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 23 Feb 2017 04:45:38 PM UTC, comment #11: 

Closing as fixed  - dicom 0.2.0 has been released

John Donoghue <lostbard>
Group Member
Wed 01 Feb 2017 05:57:56 PM UTC, comment #10: 
John Donoghue <lostbard>
Group Member
Thu 24 Jan 2013 03:53:51 PM UTC, comment #9: 

I am afraid that dicomwrite is extremely broken. I wrote most of the dicom package, but don't have time to implement dicomwrite. The problem is that I have not been able to find a general way of using the library (gdcm) to write all types of DICOM file. It looks like it would need lots of special cases implemented.

The fact that dicomwrite does not work is documented

http://sourceforge.net/p/octave/code/11601/tree/trunk/octave-forge/extra/dicom/DESCRIPTION

http://wiki.octave.org/Dicom_package

I'm really sorry about this. Hopefully a better coder than me will come along and fix this for us.

Andy Buckle <blondandy>
Thu 24 Jan 2013 03:26:16 PM UTC, comment #8: 

  Thanks for your reply!  Although I don't know how to fix the code and build the package (just a user : )).

  Hope that it'll be fixed in the next release of the dicom package.

Anonymous
Thu 24 Jan 2013 03:08:27 PM UTC, comment #7: 

Sorry about the confusion, the second code post is actually the fixed one.

Michael Goffioul <goffioul>
Thu 24 Jan 2013 03:04:46 PM UTC, comment #6: 

Reposting the code block with correct formatting:


        if (args.length() < 3) { // no metadata supplied, need to make some
                try {
                        genMinimalMetaData(&w, file);
                } catch (std::exception) {
                        return retval ;
                }
        } else { // 3rd arg should be struct to turn into metadata
                try {
                        struct2metadata(&w, file, args(2), trial, 0 /* depth of indent for SQ nesting */);
                } catch (std::exception) {
                        return retval ;
                }
        }


Michael Goffioul <goffioul>
Thu 24 Jan 2013 03:01:43 PM UTC, comment #5: 

The bug can be easily identified in dicomwrite.cpp around line 82:

if (3<args.length()) { // no metadata supplied, need to make some
try {
genMinimalMetaData(&w, file);
} catch (std::exception) {
return retval ;
}
} else { // 3rd arg should be struct to turn into metadata
try {
struct2metadata(&w, file, args(2), trial, 0 /* depth of indent for SQ nesting */);
} catch (std::exception) {
return retval ;
}
}

The test in the if-statement is inverted. It should probably be: args.length() < 3

However after fixing that, I get another crash when running: dicomwrite(rand(10), 'test.dcm')

#0  0x00007fffe324c9d1 in Fdicomwrite (args=..., nargout=0) at dicomwrite.cpp:110
#1  0x00007ffff68a6f17 in octave_builtin::do_multi_index_op (this=0x10468c0, nargout=0, args=..., lvalue_list=0x0)

Michael Goffioul <goffioul>
Thu 24 Jan 2013 02:50:36 PM UTC, comment #4: 

I can reproduce the problem under Linux. Here's the backtrace:

#0  0x00007fffe324ffa8 in octave_value::is_map (this=0x7d4878) at /opt/sw/octave-classdef/include/octave-3.7.1+/octave/../octave/ov.h:561
#1  0x00007fffe324cd6f in struct2metadata (w=0x7fffffffd150, file=0x7d4c60, ov=..., trial=false, sequenceDepth=0) at dicomwrite.cpp:129
#2  0x00007fffe324c8e0 in Fdicomwrite (args=..., nargout=0) at dicomwrite.cpp:90
#3  0x00007ffff68a6f17 in octave_builtin::do_multi_index_op (this=0x1046350, nargout=0, args=..., lvalue_list=0x0)
...

Michael Goffioul <goffioul>
Thu 24 Jan 2013 02:18:00 PM UTC, comment #3: 

  I don't know if it's a Windows-only problem since I don't have other operating system. However I have the same problem with another Win 7 x64 notebook.

  When I run Octave as administrator, the error message

     "unable to open `octave-core' for writing..."

  indeed changes to

     "save to `octave-core' complete".

  However, Octave still crashed upon dicomwrite() with segmentation violation.

Anonymous
Thu 24 Jan 2013 12:28:14 PM UTC, comment #2: 

It may be significant that you do not have
write permission for the folder in which Octave
is running.  This is the reason for the last
line in the Octave out put:
warning: unable to open `octave-core' for writing...


Michael Godfrey <godfrey>
Group Member
Thu 24 Jan 2013 12:24:20 PM UTC, comment #1: 

Do you know whether this is a Windows-only problem?

Michael Goffioul <goffioul>
Thu 24 Jan 2013 04:21:33 AM UTC, original submission:  

Operating system: Win 7 x64
Octave version: 3.6.2 VS2010
Octave Forge packages: dicom-0.1.1 VS2010
(downloaded from http://sourceforge.net/projects/octave/files/Octave%20Windows%20binaries/Octave%203.6.2%20for%20Windows%20Microsoft%20Visual%20Studio/)

The dicom package can be loaded successfully, and dicomread or dicominfo function can be called without error. Howevere when the dicomwrite function is called, Octave crashed with error message "segmentation violation" (as in the following texts).

C:\Program Files (x86)\Octave-3.6.2\bin>octave-3.6.2.exe
GNU Octave, version 3.6.2
Copyright (C) 2012 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

Octave was configured for "i686-pc-mingw32".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/help-wanted.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.

For information about changes from previous versions, type `news'.

 - Use `pkg list' to see a list of installed packages.
 - MSYS shell available (C:\Program Files (x86)\Octave-3.6.2\msys).
 - Graphics backend: qt.

octave-3.6.2.exe:1> pkg load dicom
<4.0.25794050581470_0014_000001_1310100049007f.dcm")
octave-3.6.2.exe:3> dicomwrite(A,"d:/4502721/test.dcm")
panic: Segmentation violation -- stopping myself...
attempting to save variables to `octave-core'...
warning: unable to open `octave-core' for writing...

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by blondandy (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-23 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2017-02-01 lostbard StatusConfirmed Ready For Test
        Assigned toNone lostbard
    2015-06-04 mtmiller StatusNone Confirmed
        Release3.6.2 other
        Operating SystemMicrosoft Windows Any
        SummaryCrashed on calling dicomwrite function dicom package: crash on calling dicomwrite function

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code