/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 | 647 | { |
12 | 647 | lua_State *L = luaL_newstate(); |
13 | 647 | if (L == NULL) |
14 | 0 | return 0; |
15 | | |
16 | 647 | luaL_Buffer buf; |
17 | 647 | char *s = luaL_buffinitsize(L, &buf, size); |
18 | 647 | memcpy(s, data, size); |
19 | 647 | luaL_pushresultsize(&buf, size); |
20 | 647 | if (luaL_buffaddr(&buf) == NULL) |
21 | 0 | return 0; |
22 | | |
23 | 647 | lua_settop(L, 0); |
24 | 647 | lua_close(L); |
25 | | |
26 | 647 | return 0; |
27 | 647 | } |