File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ Release date: TBA
11
11
Core and Builtins
12
12
-----------------
13
13
14
+ - Issue #23321: Fixed a crash in str.decode() when error handler returned
15
+ replacment string longer than mailformed input data.
16
+
14
17
- Issue #23048: Fix jumping out of an infinite while loop in the pdb.
15
18
16
19
- Issue #20335: bytes constructor now raises TypeError when encoding or errors
Original file line number Diff line number Diff line change @@ -4190,9 +4190,13 @@ unicode_decode_call_errorhandler_writer(
4190
4190
if (PyUnicode_READY (repunicode ) < 0 )
4191
4191
goto onError ;
4192
4192
replen = PyUnicode_GET_LENGTH (repunicode );
4193
- writer -> min_length += replen ;
4194
- if ( replen > 1 )
4193
+ if ( replen > 1 ) {
4194
+ writer -> min_length += replen - 1 ;
4195
4195
writer -> overallocate = 1 ;
4196
+ if (_PyUnicodeWriter_Prepare (writer , writer -> min_length ,
4197
+ PyUnicode_MAX_CHAR_VALUE (repunicode )) == -1 )
4198
+ goto onError ;
4199
+ }
4196
4200
if (_PyUnicodeWriter_WriteStr (writer , repunicode ) == -1 )
4197
4201
goto onError ;
4198
4202
You can’t perform that action at this time.
0 commit comments