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
Out-of-bounds read in unicodeobject.c ascii_decode() #103656
Comments
For reference, |
I am pretty sure that this is related to 1ef61cf |
The direct cause of read buffer overflow is that The current tokenizer will only do this thing when meeting '}' '!' ':'. Only 'EOF' occurs here. Lines 420 to 425 in a4967d9
I am investigating why other protection fails. |
It is an assert failure in debug mode and an overflow read access in release mode. It happens in the second round when the parser attempts with When trying to match an invalid_expression of It usually will not cause a user-visible problem since it will raise a SyntaxError anyway (still wrong if it gets passed somehow). In other cases, either there is a Everything will work fine if the value is used for the correct replacement field, even with In this special case, many more failure examples: f'{1=}{;'
f'{1=}{1;'
f'{1=}{1;}'
f'{1=}{+;'
f'{1=}{2}{;'
f'{1=}{3}{;' The most theoretically correct way is to let each replacement field use its own value. But this is indeed technically hard. A hack is possible but may open holes for further bugs. Another option is that, we skip generating |
… avoid use-after-free
…rser to avoid use-after-free
…rser to avoid use-after-free
…s to parser to avoid use-after-free
GH-103896) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
thanks all for figuring this out! |
Crash report
The following will crash the interpreter if compiled with AddressSanitizer:
This was found by OSS-Fuzz today. I reported it to the security address, who said it's fine to report to GH.
OSS-Fuzz reports this commit range as having introduced the bug: ece20db...6be7aee
Error messages
AddressSanitizer stack trace:
Your environment
Linux x64, latest cpython
main
branch checkout.Linked PRs
tok_mode
at call_invalid_rules mode #103667The text was updated successfully, but these errors were encountered: