MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031968Community[OCCT] OCCT:Data Exchangepublic2020-12-02 02:112020-12-11 12:05
ReporterNickZ 
Assigned Tobugmaster 
PrioritynormalSeveritycrash 
StatusclosedResolutionduplicate 
Platformx64OSWindowsOS Version10
Product Version[OCCT] 7.5.0 
Target Version[OCCT] 7.6.0*Fixed in Version 
Summary0031968: EXCEPTION IN STDSTORAGE::READ()
Description get an exception attempting to read the attached file using

Handle(StdStorage_Data) data;

Storage_Error res = StdStorage::Read(fileName, data); assert((res == Storage_VSOk));

The issue seems to be obvious:

FSD_CmpFile::ReadString(TCollection_AsciiString& buffer) has line

aBuf.SetValue(lv, '\0');

But '\0' is not acceptable for TCollection_AsciiString::SetValue():

void TCollection_AsciiString::SetValue (const Standard_Integer theWhere,
                                        const Standard_Character theWhat)
{
  if (theWhere <= 0 || theWhere > mylength)
  {
    throw Standard_OutOfRange ("TCollection_AsciiString::SetValue(): out of range location");
  }
  else if (theWhat == '\0')
  {
    throw Standard_OutOfRange ("TCollection_AsciiString::SetValue(): NULL terminator is passed");
  }
  mystring[theWhere - 1] = theWhat;
}

Whole FSD_CmpFile::ReadString(TCollection_AsciiString& buffer):

//=======================================================================
//function : ReadString
//purpose : read from the first none space character position to the end of line.
//=======================================================================

void FSD_CmpFile::ReadString(TCollection_AsciiString& buffer)
{
  buffer.Clear();
  TCollection_AsciiString aBuf('\0');
  FSD_File::ReadString(aBuf);
  for (Standard_Integer lv = aBuf.Length(); lv >= 1 && (aBuf.Value(lv) == '\r' || (aBuf.Value(lv) == '\n')); lv--)
    aBuf.SetValue(lv, '\0');
  buffer = aBuf;
}

This happens when aBuf in CmpFile::ReadString() is "\r".
Additional information
and documentation updates
I have fixed it for myself by changing else if (theWhat == '\0') case in TCollection_AsciiString::SetValue() to:

.....

else if (theWhat == '\0')
  {
      //throw Standard_OutOfRange ("TCollection_AsciiString::SetValue(): NULL terminator is passed");
      mylength = theWhere;
  }

mystring[theWhere - 1] = theWhat;
}
TagsNo tags attached.
Test case number
Attached Files? file icon OCC.std (7,197 bytes) 2020-12-02 02:11

- Relationships
duplicate of 0031972verifiedbugmaster Application Framework, FSD_CmpFile - exception on reading file in old persistence format with Windows EOL 
related to 0031969closedbugmaster Application Framework - cannot read .std files created by OCCT 6.9.1 

-  Notes
(0097240)
kgv (developer)
2020-12-02 14:52

Dear Bugmaster,

please close the issue as duplicate of 0031972.

- Issue History
Date Modified Username Field Change
2020-12-02 02:11 NickZ New Issue
2020-12-02 02:11 NickZ Assigned To => gka
2020-12-02 02:11 NickZ File Added: OCC.std
2020-12-02 14:51 kgv Relationship added duplicate of 0031972
2020-12-02 14:52 kgv Note Added: 0097240
2020-12-02 14:52 kgv Target Version => 7.6.0*
2020-12-02 15:21 kgv Resolution open => duplicate
2020-12-02 15:21 kgv Assigned To gka => bugmaster
2020-12-02 15:21 kgv Status new => feedback
2020-12-03 09:38 kgv Relationship added related to 0031969
2020-12-11 12:05 bugmaster Status feedback => closed


Copyright © 2000 - 2021 MantisBT Team
Powered by Mantis Bugtracker