Repository navigation
[PVM] Limit instruction data size and jump table entries in deblob - #377
Merged
Merged
Conversation
- implements the size limits of Graypaper #559 - fails `deblob_program_code` when `|j|` exceeds `Z_J`, `z` exceeds 4 octets or `|c|` exceeds `Z_C`, and checks that the rest of the blob is exactly `j`, `c` and `k` before reading any data - adds `MAX_INSTRUCTION_DATA_SIZE`, `MAX_JUMP_TABLE_ENTRY_COUNT` and `MAX_JUMP_TABLE_ENTRY_SIZE` with an error per limit - tests each limit at the bound and one above it with valid `trap` programs, and a rest that does not match the sizes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Gray Paper #559, applying code blob size limit in
blobfunction.cmovgas rule of the same PR comes with the new PVM gas model (GP #508).Deviation from GP v0.8.0
deblobhas no size limits.Changes
deblob_program_codechecks|j|,zand|c|right after decoding each one. It then checks that the rest of the blob is exactlyj,candkbefore reading any data. This replaces the trailing-octet check, and a short blob can no longer reserve the sizes its header claims.MAX_INSTRUCTION_DATA_SIZE(Z_C),MAX_JUMP_TABLE_ENTRY_COUNT(Z_J) andMAX_JUMP_TABLE_ENTRY_SIZE, with an error per limit.deblobfailure.machinereturnsHUH, andΨ_Mpanics once[PVM] Fix Ψ_M to panic when the program fails to loadlands.Z_Cis reachable only throughmachine, since other invocations bound their code byW_AorW_Cfirst.