Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#247 Crash with gdcm::Reader on a jpeg and try to Read twic

2.3
open
9
2012-07-10
2012-06-28
Pierre Le Duff
No

My problem is if i try to read for instance a jpeg file with a
gdcm::Reader().
if i try this code :
gdcm::Reader reader ;
reader.SetFileName( "c:\\toto.jpg" );
reader.Read();
readre.Read();

the program will crash ( not in gdcm v2.0.15 )
I identify the problem :
in gdcm v2.0.15 we close and set the Stream to NULL :

Ifstream->close();
delete Ifstream;
Ifstream = NULL;
Stream = NULL;

in gdcmv2.2.0 we do not set stream to NULL but we clear it so when we try a
second time to read it ( in preamble it crashes ).

Discussion

  • Pierre Le Duff
    Pierre Le Duff
    2012-06-28

    I could handle it my solution would be to add a member tryOnceToReadFile (boolean ) and to set by default to false. The first time we try to read it will set to true. The gdcm::Reader will be one shot exept if we set tryOnceToReadFile to false each time we specify a new Filename/stream

     
    • priority: 5 --> 9
    • milestone: --> 2.3
     
  • wrote .git/COMMIT_EDITMSG, 86 lines, 3114 chars
    [master ef774bc] Add a test to reproduce issue #3538586
    2 files changed, 52 insertions(+), 0 deletions(-)
    create mode 100644 Testing/Source/DataStructureAndEncodingDefinition/Cxx/TestReader4.cxx