Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 839023f

Browse files
Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
2 parents bc51a8a + 77eede3 commit 839023f

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Release date: TBA
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug
14+
build.
15+
1316
- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception
1417
loss in PyTraceBack_Here().
1518

Objects/unicodeobject.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,24 +3026,16 @@ PyUnicode_AsDecodedObject(PyObject *unicode,
30263026
const char *encoding,
30273027
const char *errors)
30283028
{
3029-
PyObject *v;
3030-
30313029
if (!PyUnicode_Check(unicode)) {
30323030
PyErr_BadArgument();
3033-
goto onError;
3031+
return NULL;
30343032
}
30353033

30363034
if (encoding == NULL)
30373035
encoding = PyUnicode_GetDefaultEncoding();
30383036

30393037
/* Decode via the codec registry */
3040-
v = PyCodec_Decode(unicode, encoding, errors);
3041-
if (v == NULL)
3042-
goto onError;
3043-
return unicode_result(v);
3044-
3045-
onError:
3046-
return NULL;
3038+
return PyCodec_Decode(unicode, encoding, errors);
30473039
}
30483040

30493041
PyObject *

0 commit comments

Comments
 (0)