-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Segmentation Fault in append_history_file of readline #122431
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
Comments
I was able to reproduce this, but it's worth noting that this only occurs with the integer FWIW, this is not a type validation problem, as the issue suggested -- that's all done by the clinic. I guess a fix could be to special-case |
This is possibly a bug upstream, in the GNU #include <editline/readline.h>
int main(void) {
append_history(-2147483646, "test.c"); // OK
append_history(-2147483647, "test.c"); // OK
append_history(-2147483649, "test.c"); // Technically ok, due to integer underflow
append_history(-2147483648, "test.c"); // Segfault
return 0;
} |
Issue has been reported upstream. In the meantime, would the best solution be to special-case raising an exception if |
…#122469) Co-authored-by: Victor Stinner <vstinner@python.org>
…_file` (pythonGH-122469) (cherry picked from commit 208b0fb) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
…_file` (pythonGH-122469) (cherry picked from commit 208b0fb) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
…_file` (python#122469) Co-authored-by: Victor Stinner <vstinner@python.org>
Uh oh!
There was an error while loading. Please reload this page.
Crash report
What happened?
Crash report
What happened?
Build
Root Cause
When calling readline.append_history_file, the first argument can be set to -2147483648, and a valid file path should be provided as the second argument. There is no proper validation logic for append_history, which can cause a crash
POC
ASAN
asan
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0a0 (heads/main:bb09ba6792, Jul 27 2024, 09:44:43) [GCC 11.4.0]
Linked PRs
readline.append_history_file
#122469readline.append_history_file
(GH-122469) #127641readline.append_history_file
(GH-122469) #127642The text was updated successfully, but these errors were encountered: