While testing OIIO, I noticed that TGAs that were being written to
disk were not being closed despite calling ImageOutput::close().
Indeed fclose is not called in TGAOutput::close when the "Artist"
attribute is empty.
The problematic block of code is:

if (!fwrite (tmpstr.c_str(), std::min (tmpstr.length (), size_t(40)))) {
    return false;
}

Since tmpstr is empty, the itemsize parameter of fwrite is 0 and
fwrite returns false, which in turn makes  TGAOutput::close early
return false (skipping the call to fclose).

Writing of other string attributes are similarly problematic when the
attribute is empty.

-Nicolas
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to