opencollada: uninitialized bool variable broke the parsing

GeneratedSaxParser::Utils:toURI() method has a bool output
parameter called failed, which is assumed to be set inside
the method before return. At some place the caller code does
not initialize the bool variable passed to this failed parameter
and so when the caller checkes the returned value it is
undefined.
e.g. it can be false when the method called successfully so
the error handling throws away the returned URI.

Change-Id: I3f90fab657a86b42bba0f492518e36c343e69d21
This commit is contained in:
Zolnai Tamás
2014-05-22 15:36:32 +02:00
parent faa9a681e7
commit 7cafb75533
2 changed files with 36 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,opencollada,$(OPENCOLLADA_TARBALL))
$(eval $(call gb_UnpackedTarball_add_patches,opencollada,\
external/opencollada/opencollada.clang.patch.0 \
external/opencollada/opencollada.libxml.patch.0 \
external/opencollada/generatedsaxparser_utils_touri_fix.patch.1 \
))
# vim: set noet sw=4 ts=4:

View File

@@ -0,0 +1,35 @@
diff -ur opencollada.org/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp opencollada/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
--- opencollada.org/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp 2014-05-22 15:24:25.437939696 +0200
+++ opencollada/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp 2014-05-22 15:24:50.769938623 +0200
@@ -865,13 +865,14 @@
{
if ( *buffer == bufferEnd )
{
- failed = false;
+ failed = true;
return COLLADABU::URI(0);
}
//Just get the string as it is for ids, so that we are able to read FBX-COLLADA
//Otherwise, calling toStringItem would result in a truncated string when an id contains spaces
//const ParserString& string = toStringListItem(buffer, bufferEnd, failed);
//return COLLADABU::URI(string.str, string.length);
+ failed = false;
return COLLADABU::URI((const char*)*buffer, bufferEnd - *buffer);
}
@@ -880,13 +881,14 @@
{
if ( **buffer == '\0' )
{
- failed = false;
+ failed = true;
return COLLADABU::URI(0);
}
//Just get the string as it is for ids, so that we are able to read FBX-COLLADA
//Otherwise, calling toStringItem would result in a truncated string when an id contains spaces
//const ParserString& string = toStringListItem(buffer, failed);
//return COLLADABU::URI(string.str, string.length);
+ failed = false;
return COLLADABU::URI((const char*)*buffer);
}