[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#342815: Xdialog: syntax error leads to infinite memory allocation loop



tags 342815 patch
thanks

The result of the ridiculous memory use is not a loop but a recursion,
which causes the stack to grow.  This generally results in a SIGSEGV as
there is no other way to report stack exhaustion to the program.

If the label for a row is empty, the row is unselectable.  If the user
attempts to select such a unselectable row, Xdialog reverts it.  The
default row is the first unless other specified, even if the first row
is unselectable.  If the user initially selects that row, and it's
unselectable, Xdialog will revert the selection to the previously
selected row, which is unselectable, so Xdialog will revert the
selection, so...

This patch disables reversion in the case that the supposedly
unselectable row was already selected, which prevents recursion.  It
would be better to make "unselectable" rows consistently unselectable
though.

--- xdialog-2.0.6/src/callbacks.c       2002-03-21 11:54:01.000000000 +0000
+++ xdialog-mine/src/callbacks.c        2006-01-22 22:20:31.000000000 +0000
@@ -777,7 +777,9 @@
 	 * select back the last selected row and exit.
 	 */
 	if (strlen(Xdialog.array[row].tag) == 0) {
-		gtk_clist_select_row(GTK_CLIST(clist), Xdialog.array[0].state, 0);
+		if (Xdialog.array[0].state != row)
+			gtk_clist_select_row(GTK_CLIST(clist),
+					     Xdialog.array[0].state, 0);
 		return;
 	}
 

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: