# HG changeset patch # User William Astle # Date 1730789303 25200 # Node ID 000381ee2d5c98534b6beb27d70e90f56e96405b # Parent 1ede8f8621cfb7dda3f77223455b03129f8b6fe6 Guard against single operand multiplication when detecting like terms This *shouldn't* happen, but it apparently does in some pathological cases so guard against a single operand multiplication to prevent a crash. diff -r 1ede8f8621cf -r 000381ee2d5c lwlib/lw_expr.c --- a/lwlib/lw_expr.c Thu Aug 08 13:46:19 2024 -0600 +++ b/lwlib/lw_expr.c Mon Nov 04 23:48:23 2024 -0700 @@ -514,8 +514,10 @@ if (e2 -> type == lw_expr_type_oper && e2 -> value == lw_expr_oper_times) { // e2 is a times + if (!(e2 -> operands -> next)) + return 0; // if there aren't at least two operands if (e2 -> operands -> next -> next) - return 0; + return 0; // if there is more than one operand if (!lw_expr_compare(e1, e2 -> operands -> next -> p)) return 0; return 1;