V3: Clang ASan heap-buffer-overflow when dispatching u8-backed enum boxed as interface
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
Research direction
Start with the ASan failure in vlib/v/tests/interfaces/interface_enum_and_fixed_array_values_test.v (test_enum_method_dispatch) and reduce it to Namer(Small.b).name() for a u8-backed enum. Compare the box allocation size with the enum storage width in vlib/v/transform/interface.v (make_interface_literal_from_expr) and vlib/v/gen/c/interface.v (gen_interface_dispatch_with_fallback, interface_concrete_storage_c_type). Done means the 1-byte enum interface case passes under the exact clang -fsanitize=address command without suppressions or larger allocations.
Written by the indexing model from the issue text.
Description
Executed historical master failure (not a queued-job inference)
- Failing master
d8083d40873efc7689abdb15f4ca21b4f5d59f4a, completed November 21, 2026, 22:22 UTC: Clang ASan-no-GC job 136897142301. - After 4,180 executed passes / 693 skips, exactly one
vlib/v/tests/interfaces/interface_enum_and_fixed_array_values_test.vfailure:test_enum_method_dispatch. Original invocation:
./v -cc clang -gc none -cflags -fno-omit-frame-pointer -cflags -fsanitize=address -silent vlib/v/tests/interfaces/interface_enum_and_fixed_array_values_test.v - ASan: READ of size 4 in
Namer__name, throughtest_enum_method_dispatch, from a 1-bytememdupallocation created by the same test. Heap address0x602000000090, region[0x602000000090,0x602000000091); read extends into the right redzone. This is a real generated-code memory-safety error, not a deliberately failing fixture, test harness timeout, or external-library sanitizer trace.
Minimal source discriminator
The test includes enum Small as u8 { a = 3; b = 200 }, fn (s Small) name() string, and assert Namer(Small.b).name() == 'small:b'. That 1-byte allocation strongly implicates the boxed Small value; the exact mismatched generated C cast is not yet established. Color and Perm also implement Namer with ordinary-width enum storage. The full fixture has the same blob 770b736ace758bf52c83b03fe64360f0d6413e76 on failing d808 and current master 9621aa02fd7d7788700846e93242d08bd70a8aea.
Relevant code for checking both sides of the ABI:
vlib/v/transform/interface.v:make_interface_literal_from_expr, especially boxconcrete_type,make_sizeof_type(concrete_type), and the_objectpointer/type registration (around 973–1154).vlib/v/gen/c/interface.v:gen_interface_dispatch_with_fallback(around 1815–2011),interface_dispatch_receiver_expr(around 118–175),interface_concrete_storage_c_type(around 2393–2413),interface_method_call_cnameandtypes.Enumhandling.- Existing merged PR #30879 added enum/interface dispatch tests and type tags, but does not establish this ASan size mismatch was corrected.
Required repair/verification
- Reduce to
Namer(Small.b).name()alone,box_namer(Small.b).name(), directSmall.b.name(), plus the same enum withas int, and inspect./v -keepc -cg -cc clanggenerated C: compare allocatedsizeof, enum typedef/storage width,Namer__namebranch_typ, selected receiver cast, andSmall__namedeclaration. - Rebuild V after a minimal proven type-registration/ABI correction; require all relevant widths to agree, not an increased allocation or sanitizer suppression without evidence. Add an explicit 1-byte enum interface regression preserving existing checks.
- Re-run the exact Clang ASan command above on a fixed descendant plus GCC ASan and normal Clang/GCC, original complete
interface_enum_and_fixed_array_values_test.v, V fmt/self checks.
Status: unresolved / still applicable by unchanged test and present boxing/dispatch code. No native V toolchain was available in the current investigation environment; no generated-C proof or patched native test is claimed.
[!NOTE]
You can use the 👍 reaction to increase the issue's priority for developers.Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
- Dominant language
- V
- Stars
- 38.1k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 682
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vlang/v
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sagemathinc/sagebrush#1683 ·
Maintainers usually reply within 1 day
-
bot-triaged module: aotinductor module: compile-time module: inductor module: performance module: rocm oncall: export oncall: pt2 triaged
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
baseballyama/rsvelte#5235 ·
Maintainers usually reply within 1 day
-
lang-core: member access on a component instance reads its internal fields instead of giving nullOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
midspiral/LemmaScript#355 · 1 comment ·
Maintainers usually reply within 1 day