1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 06:38:05 +01:00

- Fixed bug that could cause SIGSEGV by accessing beyond the end of text in

a WINGs textfield widget.
This commit is contained in:
dan
2003-03-20 13:11:13 +00:00
parent 18ed046356
commit 5f79f1bcde
3 changed files with 8 additions and 2 deletions

View File

@@ -66,6 +66,8 @@ Changes since version 0.80.2:
- Fixed bug in wmsetbg that caused scale and maxscale to both do maxscale - Fixed bug in wmsetbg that caused scale and maxscale to both do maxscale
(Alexey Voinov <voins@voins.program.ru>) (Alexey Voinov <voins@voins.program.ru>)
- Fixed bug with scrolling menus introduced by the xinerama patch. - Fixed bug with scrolling menus introduced by the xinerama patch.
- Fixed bug that could cause SIGSEGV by accessing beyond the end of text in
a WINGs textfield widget.
Changes since version 0.80.1: Changes since version 0.80.1:

View File

@@ -53,6 +53,8 @@ Changes since wmaker 0.80.1:
- Added WMGetFontName() - Added WMGetFontName()
- Added fontpanel callback - Added fontpanel callback
- Added WMSetTableViewHasHorizontalScroller() - Added WMSetTableViewHasHorizontalScroller()
- Fixed bug that could cause SIGSEGV by accessing beyond the end of text in
a WINGs textfield widget.
Changes since wmaker 0.80.0: Changes since wmaker 0.80.0:

View File

@@ -1335,12 +1335,13 @@ pointToCursorPosition(TextField *tPtr, int x)
if (tPtr->flags.bordered) if (tPtr->flags.bordered)
x -= 2; x -= 2;
a = tPtr->viewPosition;
b = tPtr->viewPosition + tPtr->textLen;
if (WMWidthOfString(tPtr->font, &(tPtr->text[tPtr->viewPosition]), if (WMWidthOfString(tPtr->font, &(tPtr->text[tPtr->viewPosition]),
tPtr->textLen - tPtr->viewPosition) < x) tPtr->textLen - tPtr->viewPosition) < x)
return tPtr->textLen; return tPtr->textLen;
a = tPtr->viewPosition;
b = tPtr->textLen;
while (a < b && b-a>1) { while (a < b && b-a>1) {
mid = (a+b)/2; mid = (a+b)/2;
tw = WMWidthOfString(tPtr->font, &(tPtr->text[tPtr->viewPosition]), tw = WMWidthOfString(tPtr->font, &(tPtr->text[tPtr->viewPosition]),
@@ -1352,6 +1353,7 @@ pointToCursorPosition(TextField *tPtr, int x)
else else
return mid; return mid;
} }
return (a+b)/2; return (a+b)/2;
} }