verifier: max_value_size and checked size accounting (Q-020, DD-015)

- spec 08 §7.1: platform-independent accounted size table shared by
  max_value_size and max_local_frame; enum tag is the smallest of
  1/2/4/8 bytes; borrows 8, slices 16; checked arithmetic, overflow is
  E5101 with found = "overflow"
- every materializable type in a module must be at most 1 MiB,
  checked before functions are verified; each oversized type reported
  once
- E5101 fields no longer truncate huge sizes
- conformance: frame_too_large, value_too_large, size_overflow
- Q-020 resolved; Phase 1 closed
This commit is contained in:
dev committed 2026-10-04 13:29:54 +03:00
1 parent e3dc0fb7bb
commit 2ddf424c14
8 files changed
+165 -34

No files matched your search

@@ -1,4 +1,4 @@
; 2 MiB of frame storage exceeds max_local_frame.
; Three locals of 400 KiB: each value fits max_value_size, the frame exceeds max_local_frame.
; expect: reject E5101
; phase: 1
; spec: docs/spec/08-verifier.md
@@ -10,5 +10,7 @@ features [arrays, ownership]
fn @f() -> void
effects []
entry:
%x = local.alloc array<u8, 2097152>
%a = local.alloc array<u8, 409600>
%b = local.alloc array<u8, 409600>
%c = local.alloc array<u8, 409600>
ret
@@ -0,0 +1,13 @@
; Computing the accounted size overflows; the verifier reports E5101 instead of trapping or crashing.
; expect: reject E5101
; phase: 1
; spec: docs/spec/08-verifier.md
module test.size_overflow
air 0
lang 0.1
features [arrays, ownership]
fn @f(%a: array<array<u64, 4294967296>, 4294967296>) -> void
effects []
entry:
ret
@@ -0,0 +1,13 @@
; array<u8, 1048577> exceeds max_value_size even as a parameter type.
; expect: reject E5101
; phase: 1
; spec: docs/spec/08-verifier.md
module test.value_too_large
air 0
lang 0.1
features [arrays, ownership]
fn @f(%a: array<u8, 1048577>) -> void
effects []
entry:
ret