Package: ydpdict Version: 0.63-1 Severity: normal Tags: patch
$ echo `tput cols`x`tput lines` 132x40 $ ydpdict -w yul Then, pressing PageDown twice causes SEGFAULT. The patch below fixes this bug. diff -ur ydpdict-0.63-org/src/ydpdict.c ydpdict-0.63-new/src/ydpdict.c --- ydpdict-0.63-org/src/ydpdict.c 2004-05-31 11:44:37.000000000 +0200 +++ ydpdict-0.63-new/src/ydpdict.c 2005-11-12 12:03:03.000000000 +0100 @@ -373,7 +373,7 @@ } else { if (menu < ysize - 5) menu = ysize - 5; - else if (pos < wordcount - 39) + else if (pos < wordcount - (ysize - 4) * 2 - 1) pos += ysize - 4; else pos = wordcount - (ysize - 4); @@ -534,10 +534,7 @@ keypad(wordwin, TRUE); halfdelay(100); - werase(wordwin); - werase(defwin); - werase(headwin); - werase(splitwin); + erase(); /* narysuj cudowną pionową linię */ for (x = 0; x < ysize; x++) { @@ -592,7 +589,7 @@ void checksize() { - int newx, newy, fake = 0; + int diff, newx, newy, fake = 0; newx = stdscr->_maxx + 1; newy = stdscr->_maxy + 1; @@ -608,6 +605,17 @@ xsize = newx; ysize = newy; + + diff = pos + (ysize - 4) - wordcount; + if (diff > 0) { + pos -= diff; + menu += diff; + } + diff = menu - (ysize - 5); + if (diff > 0) { + pos += diff; + menu -= diff; + } } /* czy podany znaczek da się wyświetlić i wprowadzić z klawiatury? */ -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (900, 'testing'), (600, 'unstable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/dash Kernel: Linux 2.6.14 Locale: LANG=C, LC_CTYPE=pl_PL (charmap=ISO-8859-2) Versions of packages ydpdict depends on: ii libc6 2.3.5-6 GNU C Library: Shared libraries an ii libncurses5 5.4-9 Shared libraries for terminal hand ydpdict recommends no packages. -- no debconf information -- Jakub Wilk