From 997d11a702ad274d8d69650b82a85797f57b8662 Mon Sep 17 00:00:00 2001 From: Liang Chang Date: Mon, 5 Apr 2021 07:11:24 +0800 Subject: [PATCH] dtappbuilder: Fix unsigned integer rollover. --- cde/programs/dtappbuilder/src/ab/abobj_resize.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cde/programs/dtappbuilder/src/ab/abobj_resize.c b/cde/programs/dtappbuilder/src/ab/abobj_resize.c index ca698dfb9..a05226652 100644 --- a/cde/programs/dtappbuilder/src/ab/abobj_resize.c +++ b/cde/programs/dtappbuilder/src/ab/abobj_resize.c @@ -537,7 +537,7 @@ abobj_resize( if (trans_x < 0) { resize_rect.x = 0; - resize_rect.width += trans_x; + resize_rect.width = max(0, resize_rect.width + trans_x); if (obj_is_pane(obj) || obj_is_separator(obj)) /* If a pane, attach to parent's edge */ obj_set_attachment(xy_obj, AB_CP_WEST, AB_ATTACH_OBJ, obj_get_parent(xy_obj), 0); @@ -556,7 +556,7 @@ abobj_resize( if (trans_y < 0) { resize_rect.y = 0; - resize_rect.height += trans_y; + resize_rect.height = max(0, resize_rect.height + trans_y); if (obj_is_pane(obj) || obj_is_separator(obj)) /* If a pane, attach to parent's edge */ obj_set_attachment(xy_obj, AB_CP_NORTH, AB_ATTACH_OBJ, obj_get_parent(xy_obj), 0); @@ -574,7 +574,7 @@ abobj_resize( if (resize_rect.x + (short)resize_rect.width >= (short)p_rect.width) { - resize_rect.width = (short)p_rect.width - resize_rect.x - 1; + resize_rect.width = max(0, (short)p_rect.width - resize_rect.x - 1); if (obj_is_pane(obj) || obj_is_separator(obj)) /* If a pane, attach to parent's edge */ obj_set_attachment(xy_obj, AB_CP_EAST, AB_ATTACH_OBJ, obj_get_parent(xy_obj), 0); @@ -590,7 +590,7 @@ abobj_resize( if (resize_rect.y + (short)resize_rect.height > (short)p_rect.height) { - resize_rect.height = (short)p_rect.height - resize_rect.y - 1; + resize_rect.height = max(0, (short)p_rect.height - resize_rect.y - 1); if (obj_is_pane(obj) || obj_is_separator(obj)) /* If a pane, attach to parent's edge */ obj_set_attachment(xy_obj, AB_CP_SOUTH, AB_ATTACH_OBJ, obj_get_parent(xy_obj), 0);