-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
fstream reuse on Windows causes a null pointer access violation #150
Comments
For refrence, the issue presents itself in The |
Also, the length is a furphie. Different lengths produce crashes in other locations. It also seems that |
Thanks for the issue report. I tested the provided code against the current standalone branch via the following commands on Windows inside the extracted folder (didn't want to install the Python and colcon stack):
Which yields:
Anyway I'll include a test case based on your code to avoid this reappearing. If you want to make sure you are using a (standalone) version where this is fixed, require a version of 11.1.1 in the CMake |
Based on code reported at boostorg#150
Thanks for the quick response. Could you please retest using a Release build? All the testing I did yesterday was using the tip of the So it looks like we have a release mode only bug. |
Based on code reported at boostorg#150
I retested the above workflow with a release build, i.e. replacing I also manually verified the code concluding that it is logically impossible for So I suspect that you somehow ended up using an older version in your test. Check the actually used include paths for the build using nowide that it uses the expected path and that it includes the fix, i.e. those 2 lines (link to current tip of the standalone branch: nowide/include/nowide/filebuf.hpp Lines 177 to 178 in 960c201
So could you please check this? As mentioned I added a test case to the tests based on your code and it passes too, see #151 |
Based on code reported at boostorg#150
Thanks for retesting. I've checked my includes and run a clean build and my release build is passing. I can't definitely account for the discrepancy, but I suspect I may have had some residual paths in my powershell environment when I ran my first tests. Thanks for the help. |
Re-using
nowide::fstream
after aclose()
andopen()
can attempt null pointer access while writing to the second file.A full project has been attached with instructions in the readme. Below is an excert of the code which will reproduce the issue.
The final line will fail, the program will crash and
out2.txt
will be empty. The test string in the example has been removed for breivity, but I've used two strings of 795 characters (I doubt it's that specified) with the same failed results. The string"hellow world"
works as expected.This appears to be specific to Windows and does not affect Ubuntu 18.04 or 20.04.
Testing using MSC 16.11.11 (Visual Studio 2019).
nowide.zip
The text was updated successfully, but these errors were encountered: