John M McIntosh wrote:
The mpeg plugin uses it to take the file name and to open it, also the freetype 2 plugin where it's the path to the font file.
Not in any version of the MPEG plugin that I have. Which reminds me: Did you see my message about the linker error due to the undefined reference to "sqFilenameFromStringOpen"? Could this be related?
The api then converts the given file name in VM platform character type (macroman/utf-8/latin-1) into a string that the host operating system can use to act upon using host operating system file calls.
Which, again, makes me want to ask why we actually burden the plugin with figuring that out instead of giving it a filename that works?
Usage of it in the standard unix based VMs can be seen in the
Cross/sqFilePluginBasicPrims.c
/* copy the file name into a null-terminated C string */ if (sqFileNameSize > 1000) { return interpreterProxy->success(false); } interpreterProxy->ioFilenamefromStringofLengthresolveAliases(cFileName,
sqFileName, sqFileNameSize, true);
I see. If the other usages are the same then the one thing that's missing from my implementation is a terminating zero character, yes?
And like David mentioned, the above is prone to buffer overflow attacks whenever the VMs encoding is larger than the image's (which is easily possible if you consider, e.g., latin1 -> utf8 conversion).
Cheers, - Andreas