summaryrefslogtreecommitdiffstats
path: root/ffi.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffi.c')
-rw-r--r--ffi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ffi.c b/ffi.c
index a6c872e9..90bcf986 100644
--- a/ffi.c
+++ b/ffi.c
@@ -1310,11 +1310,21 @@ val ffi_type_compile(val syntax)
val eltype_syntax = caddr(syntax);
val eltype = ffi_type_compile(eltype_syntax);
+ if (minusp(dim))
+ uw_throwf(error_s, lit("~a: negative dimension in ~s"),
+ self, syntax, nao);
+
{
val type = make_ffi_type_array(syntax, vec_s, dim, eltype);
struct txr_ffi_type *tft = ffi_type_struct(type);
- if (sym == zarray_s)
+
+ if (sym == zarray_s) {
tft->null_term = 1;
+ if (zerop(dim))
+ uw_throwf(error_s, lit("~a: zero dimension in ~s"),
+ self, syntax, nao);
+ }
+
if (eltype_syntax == char_s)
tft->char_conv = 1;
else if (eltype_syntax == wchar_s)