BUG: FixedList<T, N>::find may be stuck in an infinite loop
Summary
In FixedList<T, N>::find
, the pos
label is not incremented in the following while loop
if (pos >= 0)
{
List_CONST_ACCESS(T, *this, list);
while (pos < label(N))
{
if (list[pos] == val)
{
return pos;
}
}
}
Hence, if val
is not equal to the initial list[pos]
, the code will be stuck in an infinite loop.
Possible fixes
Incrementing pos
inside the loop should restore the expected behavior.
if (pos >= 0)
{
List_CONST_ACCESS(T, *this, list);
while (pos < label(N))
{
if (list[pos] == val)
{
return pos;
}
++pos;
}
}