# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1035094231 0 # Node ID c5c3ccb84ac784b8505a27e0668136c1dc0cb408 # Parent 72cb88af4490e842a4993017c35d459ab0a59bdf Safety checks in the splitbar calculations on OS/2 and Windows. diff -r 72cb88af4490 -r c5c3ccb84ac7 os2/dw.c --- a/os2/dw.c Sun Oct 20 05:39:02 2002 +0000 +++ b/os2/dw.c Sun Oct 20 06:10:31 2002 +0000 @@ -2454,12 +2454,14 @@ if(type == BOXHORZ) { start = rclFrame.xLeft - rclBounds.xLeft; - *percent = ((float)start / (float)(rclBounds.xRight - rclBounds.xLeft - SPLITBAR_WIDTH)) * 100.0; + if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) + *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; } else { start = rclFrame.yBottom - rclBounds.yBottom; - *percent = 100.0 - (((float)start / (float)(rclBounds.yTop - rclBounds.yBottom - SPLITBAR_WIDTH)) * 100.0); + if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) + *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0); } _handle_splitbar_resize(hwnd, *percent, type, width, height); } diff -r 72cb88af4490 -r c5c3ccb84ac7 win/dw.c --- a/win/dw.c Sun Oct 20 05:39:02 2002 +0000 +++ b/win/dw.c Sun Oct 20 06:10:31 2002 +0000 @@ -2293,7 +2293,7 @@ else SetCursor(LoadCursor(NULL, IDC_SIZENS)); - if(GetCapture() == hwnd) + if(GetCapture() == hwnd && percent) { POINT point; RECT rect; @@ -2309,12 +2309,14 @@ if(type == BOXHORZ) { start = point.x - rect.left; - *percent = ((float)start / (float)(rect.right - rect.left - SPLITBAR_WIDTH)) * 100.0; + if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) + *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; } else { start = point.y - rect.top; - *percent = ((float)start / (float)(rect.bottom - rect.top - SPLITBAR_WIDTH)) * 100.0; + if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) + *percent = ((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0; } _handle_splitbar_resize(hwnd, *percent, type, width, height); }