Submitted by gpersoon, also found by shw
The function sortVaultsByDelta doesnt always work as expected.
Suppose all the deltas are positive, and delta1 >= delta2 >= delta3 > 0. Then maxIndex = 0. And (delta < minDelta (==0) ) is never true, so minIndex = 0.
Then (assuming bigFirst==true):
This is clearly not what is wanted, all vaultIndexes should be different and should be in the range [0..2]. This is due to the fact that maxDelta and minDelta are initialized with the value 0. This all could results in withdrawing from the wrong vaults and reverts (because vaultIndexes[1]  is out of range).
Exposure.sol L178:
Recommend the following
kristian-gro (Gro) confirmed:
