summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-21 07:17:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-21 07:17:26 -0700
commit4c760c3b98fb4f0375b61b7b41e2c58bfca5fb59 (patch)
tree36b2c3a34a33252829f73f326c92300171f811cc
parent16ea370778dcd9943fb11767992aebf6263acfd4 (diff)
downloadtxr-4c760c3b98fb4f0375b61b7b41e2c58bfca5fb59.tar.gz
txr-4c760c3b98fb4f0375b61b7b41e2c58bfca5fb59.tar.bz2
txr-4c760c3b98fb4f0375b61b7b41e2c58bfca5fb59.zip
carray: add missing argument type checking.
* ffi.c (carray_uint, carray_int): We must use ffi_type_struct_checked here, otherwise we are blindly assuming that the element type is a FFI type.
-rw-r--r--ffi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ffi.c b/ffi.c
index 4f8ec505..89547891 100644
--- a/ffi.c
+++ b/ffi.c
@@ -5922,7 +5922,7 @@ val carray_uint(val num, val eltype_in)
{
val self = lit("carray-uint");
val eltype = default_arg(eltype_in, ffi_type_compile(uchar_s));
- struct txr_ffi_type *tft = ffi_type_struct(eltype);
+ struct txr_ffi_type *tft = ffi_type_struct_checked(self, eltype);
carray_elem_check(tft, self);
@@ -5957,7 +5957,7 @@ val carray_int(val num, val eltype_in)
{
val self = lit("carray-int");
val eltype = default_arg(eltype_in, ffi_type_compile(uchar_s));
- struct txr_ffi_type *tft = ffi_type_struct(eltype);
+ struct txr_ffi_type *tft = ffi_type_struct_checked(self, eltype);
carray_elem_check(tft, self);