-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heap-buffer-overflow when using io-related functions #733
Comments
Yes, this is a bug. The length calculation is wrong. The code uses Instead of
But that is an extension, so we should probably use Long story short: I'll try to prepare a fix. |
Actual behavior
Writing images and views to files does not work because string conversion functions are not implemented properly:
gil/include/boost/gil/io/path_spec.hpp
Lines 90 to 97 in eabd679
The code above does not work for paths that contain non-ascii symbols. The string it produces does not have
\0
at the end.Expected behavior
Passing
std::filesystem::path
orstd::wstring
to io-related functions should work properly.Possible solution is to remove explicit string conversions, construct
std::filesystem::path
and use its.string()
method.Note that it may break on windows because of usage of
fopen
gil/include/boost/gil/io/device.hpp
Line 105 in eabd679
_wfopen
should be used on windows)C++ Minimal Working Example
I've extracted broken part (linked above) to reproduce the issue: https://godbolt.org/z/rvxsPG7a4
Environment
The text was updated successfully, but these errors were encountered: