From 1cfd3b93fe284a7d41563e615755001051cb870d Mon Sep 17 00:00:00 2001 From: ulf Date: Wed, 27 Mar 2013 12:52:22 +0100 Subject: [PATCH] - Bugfix: Collada URL parser now does read 2 digits of a %xy char only, as the spec says. --- code/ColladaLoader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 5d83ccaba..37803f0fc 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -1445,13 +1445,16 @@ void ColladaLoader::ConvertPath (aiString& ss) ss.data[ss.length] = 0; } - // find and convert all %xyz special chars + // find and convert all %xy special chars char* out = ss.data; for( const char* it = ss.data; it != ss.data + ss.length; /**/ ) { - if( *it == '%' ) + if( *it == '%' && (it + 3) < ss.data + ss.length ) { - size_t nbr = strtoul16( ++it, &it); + // separate the number to avoid dragging in chars from behind into the parsing + char mychar[3] = { it[1], it[2], 0 }; + size_t nbr = strtoul16( mychar); + it += 3; *out++ = (char)(nbr & 0xFF); } else {