Re: [Bug-readline] [BUG] a race condition in add_history() leads to SIGS
From:
Chet Ramey
Subject:
Re: [Bug-readline] [BUG] a race condition in add_history() leads to SIGSEGV
Date:
Mon, 5 Dec 2016 10:35:06 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.5.0
On 12/4/16 7:42 PM, Hong Cho wrote:
>
> The race condition is that “history_length” gets updated before the
> “the_history” update is completed.
>
>
>
> In several cases we’ve encountered, “bash” got a signal (SIGHUP), which
> interrupted add_history(), leaving “the_history” and “history_length”
> inconsistent. In the signal handling path, it tried to access “the_history”
> in history_do_write() in histfile.c, which tried to de-reference a NULL
> pointer.
Thanks for the report. This looks like a good fix.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/