Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getargs.c: incorrect handling of errors in skipitem() #94930

Closed
serhiy-storchaka opened this issue Jul 17, 2022 · 0 comments
Closed

getargs.c: incorrect handling of errors in skipitem() #94930

serhiy-storchaka opened this issue Jul 17, 2022 · 0 comments
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

There is yet one bug in handling errors in getargs.c.

skipitem() returns NULL on success and non-NULL string containing an error message on error. Except one case: when the # suffix is used while PY_SSIZE_T_CLEAN is not defined. In this case an error is set and skipitem() returns NULL, but all callers of skipitem() do not expect it.

Currently this bug is only causes a hang if an optional parameter is a tuple containing a nested type with the "#" suffix, e.g. "...|(s#)...".

3.9 is most likely also affected, but only if you turn DeprecationWarning into exception (run Python with option -Werror). I am wondering whether it can be considered a security issue. @ambv

Similar issues were #87487 and #94902.

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error 3.11 only security fixes 3.10 only security fixes 3.12 bugs and security fixes labels Jul 17, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 18, 2022
…or (pythonGH-94931)

(cherry picked from commit 067f0da)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 18, 2022
…or (pythonGH-94931)

(cherry picked from commit 067f0da)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington added a commit that referenced this issue Jul 18, 2022
…-94931)

(cherry picked from commit 067f0da)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Jul 19, 2022
…ror (GH-94931) (GH-94963)

(cherry picked from commit 067f0da)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant