On 7/30/24 1:20 AM, ZeroIntensity Dev wrote:
Hi! (Apologies in advance, I'm not used to mailing lists -- I almost exclusively work on GitHub.)

I discovered this problem while looking at an issue regarding CPython's readline module. It seems that the issue was upstream, in append_history, which crashes when passed -2147483648 aka INT_MIN. For example, the following will segfault: append_history(INT_MIN, "/dev/null")

It's worth noting that in order to reproduce this, the second argument must be a file that exists -- otherwise, errno is set to ENOENT, and no crash occurs.

This very well could be the expected behavior, but it doesn't seem to be documented, nor is it consistent with the positive 32-bit signed integer limit (as in, append_history(INT_MAX, "/dev/null") does not fail.)

Well, it doesn't make much sense to pass INT_MIN to append_history (or any
negative value, really), but it shouldn't make the application crash.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/


Reply via email to