[Plib-devel] patch for current svn
Brought to you by:
sjbaker
From: olaf f. <fg...@of...> - 2007-09-07 19:43:05
|
Hi, I just updated my patch for plib to the current SVN. There is a real bug in src/ssg/ssgLoadMDL_BGLTexture.cxx http://sourceforge.net/tracker/index.php?func=detail&aid=1584727&group_id=382&atid=100382 If one would supply the Texture Loader with a character constant like "example.0af_100" the TextureLoader will bomb, because it will try to write into the constant placed into R/O memory. The bug is hidden under a workaround for standard conforming strchr() implementations which I cleaned up. (The rest of the patch) <standard blurb> strchr is defined in ANSI C++ §21.4.4 as char *strchr( char *, int); const char *strchr( const char *, int); (the fine point: it is only required to be in <cstring>, but anyway) in contrast to ANSI C (For instance 7.21.5.2 in http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf) char *strchr( const char *, int); This is one of the tiny differences between ANSI C++ and ANSI C.Please see for instance http://david.tribble.com/text/cdiffs.htm Unfortunatly GNU C++/glibc is not conforming to ANSI C++ by only defining char *strchr( const char *, int); // see yourself in <string.h> // <cstring> </standard blurb> The quintessence is: plib code compiles perfectly for Linux (except for the runtime problem mentioned above), but not for an ANSI C++ standard conforming strchr() implementation. As a side effect the code now works even for MSVC8. It should work for gcc, SUN Studio too. I like to get a fix upstream, because compiling plib is a prerequisite for the next planned FlightGear release. Please apply. Thanks, Olaf |