MXS-1308: Fix crash with multimaster=true
The multimaster node detection uses stacks to sort the node groups. The size of this stack was always assumed to be positive but it was possible that it dropped down to -1 causing a crash when the stack was accessed with the index number.
This commit is contained in:
parent
e39cbd8878
commit
5f8c426578
@ -898,7 +898,10 @@ static void visit_node(struct graph_node *node, struct graph_node **stack,
|
||||
{
|
||||
/** Pop invalid nodes off the stack */
|
||||
node->active = false;
|
||||
*stacksize -= 1;
|
||||
if (*stacksize > 0)
|
||||
{
|
||||
*stacksize -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1256,7 +1259,7 @@ monitorMain(void *arg)
|
||||
|
||||
}
|
||||
|
||||
if (handle->multimaster)
|
||||
if (handle->multimaster && num_servers > 0)
|
||||
{
|
||||
/** Find all the master server cycles in the cluster graph. If
|
||||
multiple masters are found, the servers with the read_only
|
||||
|
Loading…
x
Reference in New Issue
Block a user