diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-04 22:03:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-04 22:03:47 -0700 |
commit | e454cd2a3a02cfc41f463f232b5c1965d7c736bd (patch) | |
tree | d311f38bba314f0815134c02dd4ed289a5925d25 /ffi.c | |
parent | 9e25825ca0babfa50a8e21ba2b842ca20e9935b3 (diff) | |
download | txr-e454cd2a3a02cfc41f463f232b5c1965d7c736bd.tar.gz txr-e454cd2a3a02cfc41f463f232b5c1965d7c736bd.tar.bz2 txr-e454cd2a3a02cfc41f463f232b5c1965d7c736bd.zip |
ffi: reject negative buf size.
* ffi.c (ffi_type_compile): Check for a negative buffer
size and throw.
Diffstat (limited to 'ffi.c')
-rw-r--r-- | ffi.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1384,6 +1384,11 @@ val ffi_type_compile(val syntax) if3(sym == buf_s, ffi_buf_get, ffi_buf_d_get)); struct txr_ffi_type *tft = ffi_type_struct(type); + + if (nelem < 0) + uw_throwf(error_s, lit("~a: negative size in ~s"), + self, syntax, nao); + tft->alloc = ffi_buf_alloc; tft->free = ffi_noop_free; tft->nelem = nelem; |