Submitted by gpersoon, also found by WatchPug
Suppose someone stakes some tokens and then withdraws all of his tokens (he can still withdraw). This will result in ts.tokens being 0.
Now after some time he stakes some tokens again.
At the second stake updateStream() is called and the following if condition is false because ts.tokens==0
Thus ts.lastUpdate is not updated and stays at the value from the first withdraw.
Now he does a second withdraw. updateStream() is called an calculates the updated value of ts.tokens.
However it uses ts.lastUpdate, which is the time from the first withdraw and not from the second stake. So the value of ts.token is calculated incorrectly.
Thus more tokens can be withdrawn than you are supposed to be able to withdraw.
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L417-L447
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L455-L479
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L203-L250
Change the code in updateStream()  to:
Note: the next if statement with unstreamed and lastUpdate can be changed in a similar way to save some gas
brockelmore (Streaming Protocol) confirmed:
