Skip to content

[3.12] gh-106242: Fix path truncation in os.path.normpath (GH-106816) #107981

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

Merged
merged 4 commits into from
Aug 16, 2023

Conversation

zooba
Copy link
Member

@zooba zooba commented Aug 15, 2023

serhiy-storchaka and others added 2 commits August 15, 2023 17:23
* 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.
@zooba
Copy link
Member Author

zooba commented Aug 15, 2023

This relies on the fix in #107874 so I picked it into this PR. If the other PR is merged before then it should just disappear.

I also pre-backported #107983 to avoid a couple of compiler warnings.

@Yhg1s If you're okay with this (and #107874), would be good to have this 3.11 regression fixed in all 3.12 releases. It will get fixed in 3.11, but probably not the end of the world if it lands in 3.12.1.

@ambv
Copy link
Contributor

ambv commented Aug 15, 2023

Up to Thomas what to do with 3.12, I approved the 3.11 change.

@Yhg1s
Copy link
Member

Yhg1s commented Aug 16, 2023

#107874 was merged, so this needs double-checking that it's not unnecessarily (now) duplicating things. It's fine to get this into 3.12.

@zooba
Copy link
Member Author

zooba commented Aug 16, 2023

After the merge it's back down to the original change, so looks good to go

@Yhg1s Yhg1s merged commit ede9895 into python:3.12 Aug 16, 2023
@zooba zooba deleted the gh-106242-3.12 branch August 17, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants