# 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-9d2fd5bffc1fpull/5/merge
parent
48e2132f38
commit
1d7018c826
|
@ -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) {
|
for(;*cur != '\'';++cur) {
|
||||||
if (*cur == '\0') {
|
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] == '\'') {
|
||||||
|
// Vesanen: more than 2 escaped ' in one literal!
|
||||||
|
do {
|
||||||
|
for(cur += 2;*cur != '\'';++cur) {
|
||||||
if (*cur == '\0') {
|
if (*cur == '\0') {
|
||||||
throw STEP::SyntaxError("string literal not closed",line);
|
throw STEP::SyntaxError("string literal not closed",line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inout = cur+1;
|
while(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);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define SVNRevision 1154
|
#define SVNRevision 1257
|
||||||
|
|
Loading…
Reference in New Issue