Subject: make-struct/no-tail segfault

From: Ido Yariv <[email-masked]>
Date: Fri, 13 Jun 2025 17:51:27 -0400

Hi,

Calling make-struct/no-tail with an incorrect layout type could lead
to a segmentation fault.
For example the following:
```
(make-struct/no-tail (make-vtable standard-vtable-fields #f) 0)
```

results in:
```
Thread 1 "guile" received signal SIGSEGV, Segmentation fault.
scm_is_valid_vtable_layout (layout=0x2) at /src/guile/libguile/struct.c:165
165      c_layout = scm_i_symbol_chars (layout);
(gdb) bt
#0  scm_is_valid_vtable_layout (layout=0x2) at /src/guile/libguile/struct.c:165
#1  0x00007ffff7f4044d in scm_i_struct_inherit_vtable_magic
(vtable=vtable@entry=0x7ffff7705960, obj=obj@entry=0x7ffff7705910)
    at /src/guile/libguile/struct.c:213
#2  0x00007ffff7f406ba in scm_c_make_structv
(vtable=vtable@entry=0x7ffff7705960, n_tail=n_tail@entry=0,
n_init=n_init@entry=1,
    init=0x7fffffffdd60) at /src/guile/libguile/struct.c:366
#3  0x00007ffff7f408e9 in scm_make_struct_no_tail
(vtable=0x7ffff7705960, init=0x304) at
/src/guile/libguile/struct.c:493
```

Thanks,
Ido.