/src/testdir/tests/luaL_buffaddr_test.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include <stdint.h> |
2 | | #include <stddef.h> |
3 | | #include <string.h> |
4 | | #include <stdlib.h> |
5 | | |
6 | | #include <lua.h> |
7 | | #include <lualib.h> |
8 | | #include <lauxlib.h> |
9 | | |
10 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
11 | 301 | { |
12 | 301 | lua_State *L = luaL_newstate(); |
13 | 301 | if (L == NULL) |
14 | 0 | return 0; |
15 | | |
16 | 301 | luaL_Buffer buf; |
17 | 301 | char *s = luaL_buffinitsize(L, &buf, size); |
18 | 301 | memcpy(s, data, size); |
19 | 301 | luaL_pushresultsize(&buf, size); |
20 | 301 | if (luaL_buffaddr(&buf) == NULL) |
21 | 0 | return 0; |
22 | | |
23 | 301 | lua_settop(L, 0); |
24 | 301 | lua_close(L); |
25 | | |
26 | 301 | return 0; |
27 | 301 | } |