Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix a vulnerability to illformed ERC1155:batchTransfer events #16

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions src/datasources/erc1155.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,25 @@ export function handleTransferBatch(event: TransferBatchEvent): void

let ids = event.params.ids
let values = event.params.values
for (let i = 0; i < ids.length; ++i)

// If this equality doesn't hold (some devs actually don't follox the ERC specifications) then we just can't make
// sens of what is happening. Don't try to make something out of stupid code, and just throw the event. This
// contract doesn't follow the standard anyway.
if(ids.length == values.length)
{
registerTransfer(
event,
"/".concat(i.toString()),
contract,
operator,
from,
to,
ids[i],
values[i]
)
for (let i = 0; i < ids.length; ++i)
{
registerTransfer(
event,
"/".concat(i.toString()),
contract,
operator,
from,
to,
ids[i],
values[i]
)
}
}
}

Expand Down