Coverage Report

Created: 2023-08-27 06:20

/src/testdir/tests/luaL_traceback_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
11
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
12
718
{
13
718
  lua_State *L = luaL_newstate();
14
718
  if (L == NULL)
15
0
    return 0;
16
17
718
  char *buf = calloc(size + 1, sizeof(char));
18
718
  if (buf == NULL)
19
0
    return 0;
20
718
  memcpy(buf, data, size);
21
718
  buf[size] = '\0';
22
23
718
  luaL_traceback(L, L, buf, 1);
24
25
718
  free(buf);
26
718
  lua_settop(L, 0);
27
718
  lua_close(L);
28
29
718
  return 0;
30
718
}