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 @@ -10,6 +10,9 @@ Release date: TBA
10
10
Core and Builtins
11
11
-----------------
12
12
13
+ - Issue #23321: Fixed a crash in str.decode() when error handler returned
14
+ replacment string longer than mailformed input data.
15
+
13
16
- Issue #22286: The "backslashreplace" error handlers now works with
14
17
decoding and translating.
15
18
Original file line number Diff line number Diff line change @@ -4155,9 +4155,13 @@ unicode_decode_call_errorhandler_writer(
4155
4155
if (PyUnicode_READY (repunicode ) < 0 )
4156
4156
goto onError ;
4157
4157
replen = PyUnicode_GET_LENGTH (repunicode );
4158
- writer -> min_length += replen ;
4159
- if ( replen > 1 )
4158
+ if ( replen > 1 ) {
4159
+ writer -> min_length += replen - 1 ;
4160
4160
writer -> overallocate = 1 ;
4161
+ if (_PyUnicodeWriter_Prepare (writer , writer -> min_length ,
4162
+ PyUnicode_MAX_CHAR_VALUE (repunicode )) == -1 )
4163
+ goto onError ;
4164
+ }
4161
4165
if (_PyUnicodeWriter_WriteStr (writer , repunicode ) == -1 )
4162
4166
goto onError ;
4163
4167
You can’t perform that action at this time.
0 commit comments