# fix bug in STEPFileReader, loader fails if string literals contain more than one ". Thanks to Juha Vesanen for the patch.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1258 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/merge
aramis_acg 2012-06-17 12:15:49 +00:00
parent 48e2132f38
commit 1d7018c826
2 changed files with 17 additions and 9 deletions

View File

@ -318,20 +318,28 @@ boost::shared_ptr<const EXPRESS::DataType> EXPRESS::DataType::Parse(const char*&
else if (*cur == '\'' ) { else if (*cur == '\'' ) {
// string literal // string literal
const char* start = ++cur; const char* start = ++cur;
for(;*cur != '\'';++cur) {
if (*cur == '\0') { for(;*cur != '\'';++cur) {
if (*cur == '\0') {
throw STEP::SyntaxError("string literal not closed",line); throw STEP::SyntaxError("string literal not closed",line);
} }
} }
if (cur[1]=='\'') {
for(cur+=2;*cur != '\'';++cur) { if (cur[1] == '\'') {
if (*cur == '\0') { // Vesanen: more than 2 escaped ' in one literal!
throw STEP::SyntaxError("string literal not closed",line); do {
for(cur += 2;*cur != '\'';++cur) {
if (*cur == '\0') {
throw STEP::SyntaxError("string literal not closed",line);
}
} }
} }
while(cur[1] == '\'');
} }
inout = cur+1;
return boost::make_shared<EXPRESS::STRING>(std::string(start, static_cast<size_t>(cur-start) )); inout = cur + 1;
return boost::make_shared<EXPRESS::STRING>(std::string(start, static_cast<size_t>(cur - start)));
} }
else if (*cur == '\"' ) { else if (*cur == '\"' ) {
throw STEP::SyntaxError("binary data not supported yet",line); throw STEP::SyntaxError("binary data not supported yet",line);

View File

@ -1 +1 @@
#define SVNRevision 1154 #define SVNRevision 1257