Skip to content

Fix tag ID truncation in AssemblyItem::toSubAssemblyTag - #16987

Draft
riba2534 wants to merge 1 commit into
argotorg:developfrom
riba2534:cursor/fix-tosubassemblytag-size-t-truncation-4478
Draft

riba2534 wants to merge 1 commit into
argotorg:developfrom
riba2534:cursor/fix-tosubassemblytag-size-t-truncation-4478

Conversation

@riba2534

@riba2534 riba2534 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #16947.

toSubAssemblyTag masked the tag ID to 64 bits and then stored it in a size_t. On 32-bit size_t (e.g. the WASM build) large IDs were truncated to the lower 32 bits and pointed at unrelated tags.

Keep the ID in a uint64_t and reject values that do not fit in size_t. Coverage for an ID above 2^32 is in test/libevmasm/Assembler.cpp.

The tag ID was masked to 64 bits and then stored in a size_t, which is
only 32 bits wide on platforms such as the WebAssembly build. IDs that do
not fit in 32 bits were silently cut down to their lower 32 bits, turning
the result into a reference to an unrelated tag. Keep the ID in a
uint64_t and reject values that do not fit in a size_t instead.
@riba2534 riba2534 changed the title Do not truncate tag IDs in AssemblyItem::toSubAssemblyTag() Fix tag ID truncation in AssemblyItem::toSubAssemblyTag Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AssemblyItem AssemblyItem::toSubAssemblyTag assumes size_t is at least 64b

1 participant