devdanzin · GitHub

Bug report

Bug description:

It's possible to make a debug build of Python abort by passing an invalid Unicode argument to _interpreters.create(), resulting in SystemError: <built-in function create> returned a result with an exception set.

$ ./python -c "import _interpreters; _interpreters.create('\udc80')"
Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set
Python runtime state: initialized
UnicodeEncodeError: 'utf-8' codec can't encode character '\udc80' in position 0: surrogates not allowed
The above exception was the direct cause of the following exception:
SystemError: <built-in function create> returned a result with an exception set
Current thread 0x00007f0234dca740 (most recent call first):
  File "<string>", line 1 in <module>
Aborted

Found using fusil by @vstinner.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux, Windows

Linked PRs

Read the original on github.com ↗