Coverage Report

Created: 2025-10-27 06:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/testdir/tests/capi/luaL_traceback_test.c
Line
Count
Source
1
/*
2
 * SPDX-License-Identifier: ISC
3
 *
4
 * Copyright 2023, Sergey Bronnikov.
5
 */
6
7
#include <stdint.h>
8
#include <stddef.h>
9
#include <string.h>
10
#include <stdlib.h>
11
12
#include "lua.h"
13
#include "lualib.h"
14
#include "lauxlib.h"
15
16
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
17
541
{
18
541
  lua_State *L = luaL_newstate();
19
541
  if (L == NULL)
20
0
    return 0;
21
22
541
  char *buf = malloc(size + 1);
23
541
  if (buf == NULL)
24
0
    return 0;
25
541
  memcpy(buf, data, size);
26
541
  buf[size] = '\0';
27
28
541
  luaL_traceback(L, L, buf, 1);
29
30
541
  free(buf);
31
541
  lua_settop(L, 0);
32
541
  lua_close(L);
33
34
541
  return 0;
35
541
}