[patch] unsafe signal handler

2005-12-07 Thread Tim Waugh
Hi, Here is a patch which aims to address the problem reported earlier: http://lists.gnu.org/archive/html/bug-bash/2005-07/msg00129.html by making the signal handler set a flag which is then checked at strategic points in the main flow of code. What do you think? Tim. */ --- bash-3.0/sig.c.

Re: unsafe signal handler

2005-07-22 Thread Tim Waugh
I am looking at bash-3.0, trying to untangle the termination_unwind_protect() signal handler. I cannot work out under what circumstances the function run_interrupt_trap() is called. sighandler termination_unwind_protect (sig) int sig; { if (sig == SIGINT && signal_is_trapped (SIGINT))

Re: unsafe signal handler

2005-07-21 Thread Tim Waugh
Further information on unsafe functions used in signal handlers: a brief inspection of the code in the termination_unwind_protect() handler revealed other instances than the one highlighted before: run_interrupt_trap->_run_trap_internal->savestring->xmalloc (and more like that) maybe_save_shell_h

Re: unsafe signal handler

2005-07-18 Thread Chet Ramey
Tim Waugh wrote: > The signal handler termination_unwind_protect() can call > maybe_save_shell_history() -> append_history() -> history_do_write() > -> history_filename() -> xmalloc() -> malloc() > > and malloc() is not safe to call from a signal handler. This affects > bash-2.05b as well as bash

unsafe signal handler

2005-07-18 Thread Tim Waugh
The signal handler termination_unwind_protect() can call maybe_save_shell_history() -> append_history() -> history_do_write() -> history_filename() -> xmalloc() -> malloc() and malloc() is not safe to call from a signal handler. This affects bash-2.05b as well as bash-3.0. Tim. */ ref 163235 pg