Coverage Report

Created: 2026-01-25 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/testdir/tests/capi/luaL_buffaddr_test.c
Line
Count
Source
1
/*
2
 * SPDX-License-Identifier: ISC
3
 *
4
 * Copyright 2023-2026, 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
598
{
18
598
  lua_State *L = luaL_newstate();
19
598
  if (L == NULL)
20
0
    return 0;
21
22
598
  luaL_Buffer buf;
23
598
  char *s = luaL_buffinitsize(L, &buf, size);
24
598
  memcpy(s, data, size);
25
598
  luaL_pushresultsize(&buf, size);
26
598
  if (luaL_buffaddr(&buf) == NULL)
27
0
    return 0;
28
29
598
  lua_settop(L, 0);
30
598
  lua_close(L);
31
32
598
  return 0;
33
598
}