A word that looks like an offset can point outside the supplied data.
LET’S PICTURE IT
A page reference is unusable when its destination page is missing.
SEE IT FOR YOURSELF
Follow a dynamic string from head to tailStep 1 / 4
This example encodes one string parameter with value hello. A dynamic argument uses an offset in its head, even when it is the only argument.
This example encodes one string parameter with value hello. A dynamic argument uses an offset in its head, even when it is the only argument.At argument byte 32, the string tail begins with length five. This counts the UTF-8 payload bytes and excludes all padding.At argument byte 64, read 68 65 6c 6c 6f for hello. Twenty-seven following zero bytes fill the final content word.The encoding uses ninety-six argument bytes: one offset word, one length word and one padded content word. A normal function call adds a four-byte selector before these bytes.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Require enough bytes for the head
Before following a dynamic pointer, a decoder needs the words required by the schema. A truncated head cannot provide a complete offset value.
Check the destination and length
The referenced tail must include a readable length word, and the declared payload must fit within the supplied byte region. A huge offset does not create extra data.
Separate rejection reasons
Out-of-bounds data, incorrect alignment and non-canonical gaps are related but distinct concerns. Decoder implementations can differ in how strictly they reject unusual yet in-bounds layouts.
Report failure without inventing values
A failed decode should not be presented as a successful empty string or zero balance. Preserve the error and the schema so the user can inspect the actual mismatch.
Trace a local example
types: string
values: ["safe"]
no function selector prefix
word 0 · argument offset 0 bytes
0x0000000000000000000000000000000000000000000000000000000000000020
word 1 · argument offset 32 bytes
0x0000000000000000000000000000000000000000000000000000000000000004
word 2 · argument offset 64 bytes
0x7361666500000000000000000000000000000000000000000000000000000000
This valid control example provides a baseline before testing truncated or corrupted data.