Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reading partial objects #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Feb 15, 2021

  1. Fix crash in DcmFileFormat::readUntilTag() when reading a partial met…

    …a info
    
    Use case:
    * DcmFileFormat::readUntilTag() (called from DcmFileFormat::read())
      tries to read DcmMetaInfo which is partially available in input
      stream
    * DcmMetaInfo::read() returns EC_StreamNotifyClient
    * DcmFileFormat::readUntilTag() does not check the returned condition
      and tries to use DcmMetaInfo (by calling lookForXfer()) even though
      the object is not completely read. By using it, DcmFileFormat
      changes meta info's current elemetnt to have index -1.
    * next time DcmFileFormat::readUntilTag() is called, it tries to finish
      reading last incomplete object. Having its current index set to -1
      that leads to a crash
    
    Fix:
    * check returned condition from DcmMetaInfo::read() and exit early
      if it is bad
    akaraivanov committed Feb 15, 2021
    Configuration menu
    Copy the full SHA
    d106034 View commit details
    Browse the repository at this point in the history
  2. Fix bug in DcmMetaInfo::read() when reading incomplete in stream object

    Use case:
    * DcmMetaInfo::read() is called to read object which is partially
      available in input stream
    * Transfer syntax is detected from the preamble and is stored in
      member variable Xfer
    * On the second call to DcmMetaInfo::read() the stored transfer syntax is
      overwritten with the value of the input transfer syntax (typically EXS_Unknown).
      This time preamble is already read and is not used to detect transfer syntax.
      If input parameter is equal to EXS_Unknown current transfer syntax
      is maintained in local vairable newxfer will also be EXS_Unknown.
      Calling readGroupLength() with EXS_Unknown will return condition
      EC_IllegalCall and that is the be also the returned value of
      DcmMetaInfo::read()
    
    Fix:
    * do not overwrite store transfer syntax in Xfer if object's transfer has started
    * use stored transfer syntax on consecutive calls
    akaraivanov committed Feb 15, 2021
    Configuration menu
    Copy the full SHA
    80a0851 View commit details
    Browse the repository at this point in the history