This seems to have been delivered rather late today. But anyway, we discussed this on issue #1025 and a patch is proposed here: https://github.com/OpenImageIO/oiio/pull/1026
On Jan 7, 2015, at 4:07 PM, Thiago Ize <[email protected]> wrote: > I noticed that the OIIO Filesystem class is catching the wrong type of > exception when it calls boost::filesystem functions. These functions return > an exception of type: > boost::filesystem::filesystem_error > and OIIO is instead trying to catch the unrelated: > std::exception > > Since filesystem_error does not inherit from std::exception, that means that > any thrown exceptions are missed and can end up crashing the application. > > You can reproduce this easily with the following code provided you first run > the following command in a terminal so we can have a file that is not > accessible due to permission reasons: > $ mkdir /tmp/deny; chmod a-rwx /tmp/deny > > > try { > printf("testing Filesystem::exists: %d\n", > Filesystem::exists("/tmp/deny/etx")); > } catch(const boost::filesystem::filesystem_error e) { > std::cout<< "oiio not catching proper exception: "<<e.what() << > std::endl; > } > try { > printf("testing Filesystem::is_directory: %d\n", > Filesystem::is_directory("/tmp/deny/etx")); > } catch(const boost::filesystem::filesystem_error e) { > std::cout<< "oiio not catching proper exception: "<<e.what() << > std::endl; > } > try { > printf("testing Filesystem::is_regular: %d\n", > Filesystem::is_regular("/tmp/deny/etx")); > } catch(const boost::filesystem::filesystem_error e) { > std::cout<< "oiio not catching proper exception: "<<e.what() << > std::endl; > } > try { > std::cout <<"testing Filesystem::last_write_time: "<< > Filesystem::last_write_time("/tmp/deny/etx") <<std::endl; > } catch(const boost::filesystem::filesystem_error e) { > std::cout<< "oiio not catching proper exception: "<<e.what() << > std::endl; > } > > Here's the output using OIIO 1.4 which shows that the exceptions were not > caught by OIIO and instead were caught by our test code: > > testing Filesystem::exists: oiio not catching proper exception: > boost::filesystem::status: Permission denied: "/tmp/deny/etx" > testing Filesystem::is_directory: oiio not catching proper exception: > boost::filesystem::status: Permission denied: "/tmp/deny/etx" > testing Filesystem::is_regular: oiio not catching proper exception: > boost::filesystem::status: Permission denied: "/tmp/deny/etx" > testing Filesystem::last_write_time: oiio not catching proper exception: > boost::filesystem::last_write_time: Permission denied: "/tmp/deny/etx" > > The fix is a pretty simple search and replace in filesystem.cpp, so I didn't > bother to include a patch. If a patch is wanted, let me know! > > I didn't check the rest of OIIO, but it might be worth doing some quick > investigations to see if this problem exists elsewhere. > _______________________________________________ > Oiio-dev mailing list > [email protected] > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org -- Larry Gritz [email protected]
_______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
