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

2.9
open
9
2017-07-26
2012-06-28
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

     
  • Mathieu Malaterre

    • priority: 5 --> 9
    • milestone: --> 2.3
     
  • Mathieu Malaterre

    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

     
  • Mathieu Malaterre

    • Group: 2.3 --> 2.5
     

Log in to post a comment.