Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!oliveb!sun!gorodish!guy From: guy@gorodish.UUCP Newsgroups: comp.bugs.4bsd Subject: "overwrite" in -lcurses drops core Message-ID: <15585@sun.uucp> Date: Tue, 24-Mar-87 23:12:17 EST Article-I.D.: sun.15585 Posted: Tue Mar 24 23:12:17 1987 Date-Received: Fri, 27-Mar-87 00:45:30 EST Sender: news@sun.uucp Lines: 61 Index: usr.lib/libcurses/overwrite.c 4.3BSD Description: "overwrite" can drop core in some circumstances. Repeat-By: Run the following program: # include char junk[] = "junk"; char morjunk[] = "MORE JUNK"; main() { WINDOW *win, *swin, *twin; int i, j; initscr (); noecho(); crmode(); twin = newwin(LINES,COLS,0,0); wclear(twin); for(i = 0; i < LINES - 1; i++) for(j = 0; j < COLS - 1; j++) mvwaddch(twin, i, j, 'A' + i); wrefresh (twin); getch(); win = newwin(LINES/2, COLS/2, 0, COLS/2); swin = subwin(win, LINES/2-1, COLS/2-1, 1, COLS/2+1); overwrite(twin, swin); for(i = 1; i < LINES/2-2; i++) for(j = 1; j < COLS/2-2; j++) mvwaddch(win, i, j, morjunk[j % (sizeof(morjunk)-1)]); touchwin(win); wrefresh(win); getch(); endwin(); } It will paint the screen and stop. When it stops, hit RETURN and watch it drop core. Fix: *** /arch/4.3/usr/src/usr.lib/libcurses/overwrite.c Fri Jun 7 11:39:28 1985 --- overwrite.c Tue Mar 24 20:05:06 1987 *************** *** 29,35 **** # endif starty = max(win1->_begy, win2->_begy); startx = max(win1->_begx, win2->_begx); ! endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begx); endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); if (starty >= endy || startx >= endx) return; --- 29,35 ---- # endif starty = max(win1->_begy, win2->_begy); startx = max(win1->_begx, win2->_begx); ! endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begy); endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); if (starty >= endy || startx >= endx) return;