Skip to content

Commit 429feaf

Browse files
author
David Wootton
committed
Explicitly test num_nodes and tree_order to avoid divide by zero since
asserts are compiled out in release builds. Signed-off-by: David Wootton <dwootton@us.ibm.com>
1 parent 53acf37 commit 429feaf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ompi/patterns/net/netpatterns_knomial_tree.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,10 @@ OMPI_DECLSPEC int ompi_netpatterns_setup_recursive_knomial_tree_node(
548548

549549
assert(num_nodes > 1);
550550
assert(tree_order > 1);
551+
/* Also validate in release build where asserts are compiled out */
552+
if ((num_nodes <= 1) || (tree_order <= 1)) {
553+
goto Error;
554+
}
551555
if (tree_order > num_nodes) {
552556
tree_order = num_nodes;
553557
}

0 commit comments

Comments
 (0)