mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
parser: fix panic, discovered by fuzzing examples/2048/2048.v with zzuf on the CI
This commit is contained in:
parent
309aebfaf1
commit
aebe9bc1c8
1 changed files with 5 additions and 2 deletions
|
@ -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())) {
|
|| (p.tok.kind == .lsbr && p.is_array_type())) {
|
||||||
// [100]u8
|
// [100]u8
|
||||||
elem_type = p.parse_type()
|
elem_type = p.parse_type()
|
||||||
if p.table.sym(elem_type).name == 'byte' {
|
if elem_type != 0 {
|
||||||
p.error('`byte` has been deprecated in favor of `u8`: use `[10]u8{}` instead of `[10]byte{}`')
|
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()
|
last_pos = p.tok.pos()
|
||||||
is_fixed = true
|
is_fixed = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue