Menu

#468 gdcm::String does not keep padding in mind when comparing to char* and std::string

3.1
open
None
5
2021-05-04
2018-11-30
seriousalex
No

I have discovered that in GDCM exist places, where strings are compared with raw strings (const char*) without applying padding (which always results in GDCM believing that strings are different even when they are not).

For instance, this code (gdcmPixmapWriter.cxx:789):

      Attribute<0x0002,0x0010> at;
      at.SetFromDataSet( fmi );
      const char *tsuid = TransferSyntax::GetTSString( ts );
      UIComp tsui  = at.GetValue();
      if( tsui != tsuid )
      {
        gdcmErrorMacro( "Incompatible TransferSyntax." );
         return false;
      }

Tries to compare gdcm::String with const char* and fails if length of tsuid is odd.
This very example is not so important as it is in the undocumented section, but I thought this issue might arise somewhere else and is worth some attention.

Discussion

  • Mathieu Malaterre

    String::Trim() needs to be used explicitely

     
  • Mathieu Malaterre

    • assigned_to: Mathieu Malaterre
    • Group: 2.8.8 --> 3.1
     

Log in to post a comment.

MongoDB Logo MongoDB