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
bootloader: replace stray MAX_PATH with PATH_MAX #5617
bootloader: replace stray MAX_PATH with PATH_MAX #5617
Conversation
We also really should go through the codebase and add checks for failed But that's a fight for another day, and another PR... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that didn't take long...
I guess actually before I get too overexcited could you build a wheel containing rebuilt bootloaders and ask @hackenjoe to verify it? Or we could add a very long path test? |
I'll add a long filename test. I'm beginning to suspect that #5615 has an unrelated underlying issue that has uncovered this path-length related bug... |
Test whether filenames with paths longer than 260 (MAX_PATH on Windows) are properly extracted from onefile build's CArchive.
d7e60f3
to
305789a
Compare
Alright, here's the revised version. The added |
On Windows, `pyi_path_fopen()` erroneously uses `MAX_PATH` (260) instead of `PATH_MAX` (4096) to convert the filename to wide characters, which causes `MultiByteToWideChar()` call in `pyi_win32_utils_from_utf8()` to fail with ``` MultiByteToWideChar: The data area passed to a system call is too small. ``` when we try to open a file with a long filename (> 260). Due to lack of error checking, the resulting `wfilename` array ends up with random content, and the `_wfopen()` call either fails (in read-only mode) or creates a randomly-named file (in write mode).
305789a
to
fc294f4
Compare
I guess it's comforting to know that the test also fails after bootloader is rebuilt if the test system doesn't have long names enabled... It also explains the |
8db4768
to
dc4673e
Compare
On Windows,
pyi_path_fopen()
erroneously usesMAX_PATH
(260) instead ofPATH_MAX
(4096) to convert the filename to wide characters, which causesMultiByteToWideChar()
call inpyi_win32_utils_from_utf8()
to fail withwhen we try to open a file with a long filename (> 260).
Due to lack of error checking, the resulting
wfilename
array ends up with random content, and the_wfopen()
call either fails(in read-only mode) or creates a randomly-named file (in write mode).
Fixes #5615.