Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: introduce ffi_cdef_proto_test
LuaJIT has a FFI library which allows calling external C functions and using C data structures from a pure Lua code, see [1]. According to a FFI API documentation [2] the Lua function `ffi.cdef(def)` adds multiple C declarations for types or external symbols (named variables or functions). `def` must be a Lua string. The contents of the string `def` must be a sequence of C declarations, separated by semicolons. The C parser complies to the C99 language standard plus the extensions described in [3]. Note, LuaJIT C parser is not a validating C parser. It expects and accepts correctly formed C declarations. Therefore without grammar-aware fuzzing we will face with a false-positive crashes. The patch adds a grammar-aware test, where C declarations generated automatically using Protobuf grammar and LibProtoBuf-mutator and then serialize Protobuf structure to a string. Note, an implementation is not finished yet. An example of bug in `src/lj_cparse.c` is LJ#1114. 1. https://luajit.org/ext_ffi.html 2. https://luajit.org/ext_ffi_api.html 3. https://luajit.org/ext_ffi_semantics.html#clang 4. https://luajit.org/ext_ffi_semantics.html#status
- Loading branch information