From da42c7259ddeaf80fdfda7586412adb7c07cffd2 Mon Sep 17 00:00:00 2001 From: spo Date: Thu, 28 May 2015 15:23:09 +0300 Subject: [PATCH] Issue #529: 4.07. Import IGES, export to BREP, STEP, IGES - Fix crash on input file for export by hand --- src/ExchangePlugin/ExchangePlugin_Validators.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; -- 2.39.2