bug-ncurses
[Top][All Lists]
Advanced

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

Bug in deleting multiple screens


From: Scott Dolim
Subject: Bug in deleting multiple screens
Date: Mon, 5 Jul 2010 12:37:41 -0700

I found another bug in ncurses 5.7.  It has to do with the following sequence:

A = newterm(...)
B = newterm(...)
...
delscreen(A)
delscreen(B)

After this, the variable _nc_screen_chain should end up NULL again,
but it is not.  It is left pointing at the address where A used to be.
 Later, the following sequence:

C = newterm()
...
delscreen(C)

will crash because C's _next_screen is pointing at A but that memory
has since been reused for something else.

The problem appears to be in delink_screen(), in that the previous
screen's _next_screen pointer is not being updated correctly.  I've
included a tiny patch that fixes the issue.  (Of course, you may have
caught and fixed this already in 5.8, or possibly aren't using a
global _nc_screen_chain anymore.)

-- Scott

Attachment: lib_set_term.c.patch
Description: Text Data


reply via email to

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