Submitted by chaduke, also found by adriro
The data structure _ownedTokensIndex is SHARED by different owners, as a result, _removeTokenFromAllTokensEnumeration() might remove the wrong tokenId.
_ownedTokensIndex is used to map from token ID to index of the owner tokens list, unfortunately, all owners share the same data structure at the same time (non-fungible tokens). So, the mapping for one owner might be overwritten by another owner when _addTokenToOwnerEnumeration is called: https://github.com/code-423n4/2023-01-timeswap/blob/ef4c84fb8535aad8abd6b67cc45d994337ec4514/packages/v2-token/src/base/ERC1155Enumerable.sol#L116-L121.
As a result,    _removeTokenFromOwnerEnumeration() might remove the wrong tokenID.
Removing the wrong tokenID can happen like the following:
Remix
Redefine ownedTokensIndex so that is is not shared:
vhawk19 (Timeswap) confirmed and commented:
