Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 9d55a03efef94657d33b076ba3fc3817 > files > 1

libxaw-1.0.4-1mdv2008.0.src.rpm

From 4c8c7245d5acb9540f7ee0a5379b49b77f84198a Mon Sep 17 00:00:00 2001
From: Ademar de Souza Reis Jr <ademar@mandriva.com.br>
Date: Tue, 3 Jul 2007 17:24:29 -0300
Subject: [PATCH] fix potential infinte loop in XawBoxQueryGeometry()

The problem is due to a short integer overflow when
request_mode == CWHeight.

Patch from Glenn Burkhardt <gbburkhardt@verizon.net>
---
 src/Box.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Box.c b/src/Box.c
index f4f2939..88dfd30 100644
--- a/src/Box.c
+++ b/src/Box.c
@@ -395,9 +395,10 @@ XawBoxQueryGeometry(Widget widget, XtWidgetGeometry *constraint,
 	if (preferred_width <= constraint->width) {
 	    width = preferred_width;
 	    do { /* find some width big enough to stay within this height */
-		width <<= 1;
-		if (width > constraint->width)
+		if (width > constraint->width >> 1) /* avoid short int overflow */
 		    width = constraint->width;
+		else
+		    width <<= 1;
 		DoLayout(w, width, 0, &preferred_width, &preferred_height, False);
 	    } while (preferred_height > constraint->height
 		     && width < constraint->width);
-- 
1.5.2.2