gh-153603: Fix out-of-bounds read in the ISO-2022 decoder for an unknown charset - #153604
Conversation
…n unknown charset The designation-table scan compiled its terminator only under Py_DEBUG, so a release build walked off the table for an unknown charset set via setstate(). Make the terminator unconditional and report the byte as undecodable.
|
Thanks @tonghuaroot for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-155959 is a backport of this pull request to the 3.15 branch. |
|
GH-155960 is a backport of this pull request to the 3.14 branch. |
|
GH-155961 is a backport of this pull request to the 3.13 branch. |
…an unknown charset (GH-153604) (GH-155961) The designation-table scan compiled its terminator only under Py_DEBUG, so a release build walked off the table for an unknown charset set via setstate(). Make the terminator unconditional and report the byte as undecodable. (cherry picked from commit f40043e) Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
…an unknown charset (GH-153604) (GH-155960) The designation-table scan compiled its terminator only under Py_DEBUG, so a release build walked off the table for an unknown charset set via setstate(). Make the terminator unconditional and report the byte as undecodable. (cherry picked from commit f40043e) Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
|
|
The ISO-2022 decoders' designation-table scan compiled its
dsg->mark != '\0'terminator only under
Py_DEBUG, so a release build walked off the table for anunknown charset set via
setstate(). Make the terminator unconditional andreport the byte as undecodable when the charset is unknown.