]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #529: 4.07. Import IGES, export to BREP, STEP, IGES - Fix crash on input file...
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 28 May 2015 12:23:09 +0000 (15:23 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Thu, 28 May 2015 12:27:11 +0000 (15:27 +0300)
src/ExchangePlugin/ExchangePlugin_Validators.cpp

index 16df0a1fe6b5946f4940f14cf3cad44b350882dd..bffd2fa419844ae5bf94b7f050505d62b87e98ac 100644 (file)
@@ -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;