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
commiteae9d42156544b68e1b3217a3e907867d5c11fd3 (patch)
tree36b2c3a34a33252829f73f326c92300171f811cc
parent99bb6596a8ad310cd8751b055ad38b95031a1f44 (diff)
downloadtxr-eae9d42156544b68e1b3217a3e907867d5c11fd3.tar.gz
txr-eae9d42156544b68e1b3217a3e907867d5c11fd3.tar.bz2
txr-eae9d42156544b68e1b3217a3e907867d5c11fd3.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);