bpo-36819: Fix crashes in built-in encoders with weird error handlers by serhiy-storchaka · Pull Request #28593 · python/cpython

@serhiy-storchaka

If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.

vstinner

@serhiy-storchaka

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

May 2, 2022
…pythonGH-28593)

If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.
(cherry picked from commit 18b07d7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

miss-islington added a commit that referenced this pull request

May 2, 2022
…GH-28593)

If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.
(cherry picked from commit 18b07d7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

miss-islington added a commit that referenced this pull request

May 2, 2022
…GH-28593)

If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.
(cherry picked from commit 18b07d7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

@ATalaba ATalaba mannequin mentioned this pull request

Apr 10, 2022

hello-adam pushed a commit to hello-adam/cpython that referenced this pull request

Jun 2, 2022
…pythonGH-28593)

If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.
(cherry picked from commit 18b07d7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>