From: spo Date: Thu, 28 May 2015 12:23:09 +0000 (+0300) Subject: Issue #529: 4.07. Import IGES, export to BREP, STEP, IGES - Fix crash on input file... X-Git-Tag: V_1.2.0~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=da42c7259ddeaf80fdfda7586412adb7c07cffd2;p=modules%2Fshaper.git Issue #529: 4.07. Import IGES, export to BREP, STEP, IGES - Fix crash on input file for export by hand --- diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.cpp b/src/ExchangePlugin/ExchangePlugin_Validators.cpp index 16df0a1fe..bffd2fa41 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Validators.cpp @@ -59,9 +59,11 @@ bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute, std::transform(aFileName.begin(), aFileName.end(), aFileName.begin(), toupper); // Is file name ends with the format for (; itFormats != aFormats.end(); ++itFormats) { - size_t aFormatBeginPos = aFileNameLen - (*itFormats).length(); - if (aFileName.compare(aFormatBeginPos, std::string::npos, *itFormats) == 0) { - return true; + if (aFileNameLen > (*itFormats).length()) { + size_t aFormatBeginPos = aFileNameLen - (*itFormats).length(); + if (aFileName.compare(aFormatBeginPos, std::string::npos, *itFormats) == 0) { + return true; + } } } return false;