From aebe9bc1c800fbd645c17e88090691e5e269c809 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 9 Mar 2025 12:16:32 +0200 Subject: [PATCH] parser: fix panic, discovered by fuzzing examples/2048/2048.v with zzuf on the CI --- vlib/v/parser/containers.v | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vlib/v/parser/containers.v b/vlib/v/parser/containers.v index 06e3bdad92..b5a5cf5c6f 100644 --- a/vlib/v/parser/containers.v +++ b/vlib/v/parser/containers.v @@ -75,8 +75,11 @@ fn (mut p Parser) array_init(is_option bool, alias_array_type ast.Type) ast.Arra || (p.tok.kind == .lsbr && p.is_array_type())) { // [100]u8 elem_type = p.parse_type() - if p.table.sym(elem_type).name == 'byte' { - p.error('`byte` has been deprecated in favor of `u8`: use `[10]u8{}` instead of `[10]byte{}`') + if elem_type != 0 { + s := p.table.sym(elem_type) + if s.name == 'byte' { + p.error('`byte` has been deprecated in favor of `u8`: use `[10]u8{}` instead of `[10]byte{}`') + } } last_pos = p.tok.pos() is_fixed = true