GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-106844: Fix null-bytes handling in LCMapStringEx in _winapi by serhiy-storchaka · Pull Request #107832 · python/cpython Conversation
|
|
Before merging it I want to manually test it on Windows with large strings, and maybe add bigmem tests if it is feasible. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| NULL, NULL, 0); | ||
| if (dest_size == 0) { | ||
| return PyErr_SetFromWindowsErr(0); | ||
| if (dest_size <= 0) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It can return negative value. At least if src_size is negative. But the second call returns 0 anyway.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (dest_size == 0) { | ||
| return PyErr_SetFromWindowsErr(0); | ||
| if (dest_size <= 0) { | ||
| DWORD error = GetLastError(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Other code calls GetLastError() as early as possible, before PyMem_Free(). Perhaps there is a reason of it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyMem_Free(src_); | ||
| PyObject *ret = PyUnicode_FromWideChar(dest, nmapped); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It reduces the maximal total memory consumption if free this memory before allocating new memory in PyUnicode_FromWideChar().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-107832) * Strings with length from 2**31-1 to 2**32-2 always caused MemoryError, it doesn't matter how much memory is available. * Strings with length exactly 2**32-1 caused OSError. * Strings longer than 2**32-1 characters were truncated due to integer overflow bug. * Strings containing the null character were truncated at the first null character. Now strings longer than 2**31-1 characters caused OverflowError and the null character is allowed.. (cherry picked from commit 04cc014) Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-107874 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-107832) * Strings with length from 2**31-1 to 2**32-2 always caused MemoryError, it doesn't matter how much memory is available. * Strings with length exactly 2**32-1 caused OSError. * Strings longer than 2**32-1 characters were truncated due to integer overflow bug. * Strings containing the null character were truncated at the first null character. Now strings longer than 2**31-1 characters caused OverflowError and the null character is allowed.. (cherry picked from commit 04cc014) Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-107875 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for fixing this! 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-107875) * Strings with length from 2**31-1 to 2**32-2 always caused MemoryError, it doesn't matter how much memory is available. * Strings with length exactly 2**32-1 caused OSError. * Strings longer than 2**32-1 characters were truncated due to integer overflow bug. Now strings longer than 2**31-1 characters caused OverflowError. (cherry picked from commit 04cc014)
* Strings with length from 2**31-1 to 2**32-2 always caused MemoryError, it doesn't matter how much memory is available. * Strings with length exactly 2**32-1 caused OSError. * Strings longer than 2**32-1 characters were truncated due to integer overflow bug. * Strings containing the null character were truncated at the first null character. Now strings longer than 2**31-1 characters caused OverflowError and the null character is allowed.
…07874) * Strings with length from 2**31-1 to 2**32-2 always caused MemoryError, it doesn't matter how much memory is available. * Strings with length exactly 2**32-1 caused OSError. * Strings longer than 2**32-1 characters were truncated due to integer overflow bug. * Strings containing the null character were truncated at the first null character. Now strings longer than 2**31-1 characters caused OverflowError and the null character is allowed.. (cherry picked from commit 04cc014)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.