bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug found when freeing screen(s)


From: Frédéric Boiteux
Subject: Re: bug found when freeing screen(s)
Date: Fri, 17 Sep 2010 11:03:50 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100805 Icedove/3.0.6

Le 17/09/2010 10:49, Thomas Dickey a écrit :
> On Fri, Sep 17, 2010 at 10:27:19AM +0200, Frédéric Boiteux wrote:
>   
>>     Hello,
>>
>> When porting an own application using ncurses from an old 5.5 version to
>> a current 5.7 (from Debian Lenny system), I found a bug related to free
>> of screens (the application manages multiple terminals) : when the close
>> of terminals was in the same order they was created, the application
>> segfaulted or looped indefinitely. I identified the bug in the
>> delscreen() function, and more precisely in delink_screen() where the
>> global list of screens is incorrectly updated.
>>   I've successfully tested my application with the simple patch attached.
>>
>>   I think the bug is already present in latest version of ncurses.
>>     
> The current code has this fix, from 2010/4/24:
>
>    fix warnings from clang --analyze
>    (this was a coding error)
>
> --- lib_set_term.c      2010/04/24 23:09:24     1.136 
> +++ lib_set_term.c      2010/05/01 19:47:51     1.137 
> @@ -47,7 +47,7 @@ 
>  #define CUR SP_TERMTYPE
>  #endif
>
> -MODULE_ID("$Id: lib_set_term.c,v 1.135 2009/11/28 21:49:24 tom Exp $") 
> +MODULE_ID("$Id: lib_set_term.c,v 1.136 2010/04/24 23:09:24 tom Exp $") 
>
>  #ifdef USE_TERM_DRIVER
>  #define MaxColors      InfoOf(sp).maxcolors
> @@ -117,7 +117,7 @@ 
>      for (each_screen(temp)) {
>         if (temp == sp) {
>             if (last)
> -               last = sp->_next_screen; 
> +               last->_next_screen = sp->_next_screen; 
>             else
>                 _nc_screen_chain = sp->_next_screen;
>             result = TRUE;
>
>   

Ok, I checked latest source *from Debian* (Sid), which was tagged
20100313, so I missed the fix !

I'll report that against Debian bug tracking to ask for them to update
their package.

  Thanks for your quick reply,

       Fred.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]