|
while (boundaryPixels[priority].empty() && (priority < 256)) |
The conditions order should be inverted: first check that priority is less than 256, next check that boundaryPixels is empty at this index. That is, "while (priority < 256 && boundaryPixels[priority].empty())". Otherwise, the boundaryPixels is accessed beyond its bounds when the priority reaches 256.
mser/mser.cpp
Line 264 in 7347d00
The conditions order should be inverted: first check that priority is less than 256, next check that boundaryPixels is empty at this index. That is, "while (priority < 256 && boundaryPixels[priority].empty())". Otherwise, the boundaryPixels is accessed beyond its bounds when the priority reaches 256.