[Cg1] Bugfix for the OBJ loader

Gereon Fox s9gefoxx at stud.uni-saarland.de
Fri Jan 30 16:45:25 CET 2015


we've discovered a bug in the OBJ loader, that made it crash when the
model to be loaded contained a "mtllib" directive: The line

> while (str.c_str()[pos]!=' ' && str.c_str()[pos]!='\t' &&
> str.c_str()[pos]!='\n')   ++pos;

in FileLine::fetchString in obj.cpp needs to be extended to read
> while (pos < str.length() && str.c_str()[pos]!=' ' &&
> str.c_str()[pos]!='\t' && str.c_str()[pos]!='\n')   ++pos;

in order to avoid "pos" pointing to nowhere if the argument for the
mtllib directive does not contain any white space.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0xC4C8BB20.asc
Type: application/pgp-keys
Size: 3856 bytes
Desc: not available
URL: <https://mail.cg.uni-saarland.de/cgi-bin/mailman/private/cg1/attachments/20150130/f449c8e5/attachment.key>

More information about the Cg1 mailing list