BIT-python-min-2025-4516: Use-after-free in "unicode_escape" decoder with error handler
Published May 15, 2025
·Updated
There is an issue in CPython when using bytes.decode("unicodeescape", error="ignore|replace"). If you are not using the "unicodeescape" encoding or an error handler your usage is not affected. To work-around this issue you may stop using the error= handler and instead wrap the bytes.decode() call in a try-except catching the DecodeError.
Affected Software
1 affected component
Python Software Foundation CPython
Event History
May 15, 2025
CVE Published
via OSV·01:29 PM
Data Sourced
via OSV·01:29 PM
DescriptionSeverityWeakness
Frequently Asked Questions
1
Which applications are exposed to this issue?
Applications are affected only if they call bytes.decode() with the "unicode_escape" encoding and use the error="ignore" or error="replace" handler. Uses that do not combine this encoding with an error handler are not affected.
2
What can be done if an update cannot be applied immediately?
Avoid using the error= handler for the unicode_escape decode operation. Instead, call bytes.decode() without that handler and wrap the call in try-except to catch DecodeError.