Submitted by shw
The leveragedNotionalValue function of LibBalance gets the margin value of a position (i.e., the marginValue variable) to calculate the notional value. However, the positions margin value is not checked to be non-negative. Margin with a value less than zero is considered invalid and should be specially handled. L80 in LibBalances.sol.
Recommend checking whether marginValue is less than zero and handle this case.
OsmanBran acknowledged:
