fix underflow condition in rxvt_selection_adjust_kanji function.

from Gregory Steuck <greg at y2006.nest.cx>, thanks!
ok jolan@
This commit is contained in:
steven 2006-01-24 19:14:18 +00:00
parent b3defa3558
commit a28bbba028
2 changed files with 25 additions and 2 deletions

View File

@ -1,11 +1,12 @@
# $OpenBSD: Makefile,v 1.32 2004/12/19 17:36:33 alek Exp $
# $OpenBSD: Makefile,v 1.33 2006/01/24 19:14:18 steven Exp $
COMMENT= "color, low memory usage, xterm replacement"
COMMENT-clock= "analog clock for X11 w/appoint. reminder and mail notif"
VER= 2.7.10
DISTNAME= rxvt-${VER}
PKGNAME-clock= rclock-${VER}
PKGNAME= rxvt-${VER}p0
PKGNAME-clock= rclock-${VER}p0
CATEGORIES= x11
MASTER_SITES= ftp://ftp.rxvt.org/pub/rxvt/ \
ftp://ftp.ics.es.osaka-u.ac.jp/pub/mirrors/rxvt/ \

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-src_screen_c,v 1.1 2006/01/24 19:14:18 steven Exp $
There is an underflow condition in rxvt_selection_adjust_kanji triggered
when one drags the mouse holding left button along the left side of the
window (c1 == 0). The added check prevents reading memory before the
allocated buffer. This seems to also be semantically correct as there is
no need to extend selection when there is nothing selected on the line.
--- src/screen.c.orig Sat Dec 10 18:58:35 2005
+++ src/screen.c Sat Dec 10 19:05:48 2005
@@ -3211,9 +3211,9 @@ rxvt_selection_adjust_kanji(rxvt_t *r)
&& IS_MULTI1(r->screen.rend[r1][c1 - 1]))
r->selection.beg.col--;
}
- if (r->selection.end.col < r->TermWin.ncol) {
+ c1 = r->selection.end.col;
+ if (0 < c1 && c1 < r->TermWin.ncol) {
r1 = r->selection.end.row + r->TermWin.saveLines;
- c1 = r->selection.end.col;
if (IS_MULTI1(r->screen.rend[r1][c1 - 1])
&& IS_MULTI2(r->screen.rend[r1][c1]))
r->selection.end.col++;