The function wredrawln attempts to check for off-screen windows to avoid
buffer overflow, however it fails to take window offset into account misses
several problems.
Here are two sample programs that test this.
http://web.mit.edu/davidben/Public/curses_x.c
http://web.mit.edu/davidben/Public/curses_y.c
Not every stray write appears to result in a segfault. (On my machine,
curses_y 1 manages, but curses_x seems to escape notice.) Valgrind can catch
the stray writes more accurately.
Here is a patch that should apply to ncurses-5.7-20100424