mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
c84a37ae93
Linux 6.10+ with CONFIG_FORTIFY_SOURCE notices memcpy() accessing past the end of TString, because it has no indication that there there may be an additional allocation there. There's no appropriate upstream change for this (ancient) version of Lua, so this is the narrowest change I could come up with to add a flex array field to the end of TString to satisfy the check. It's loosely based on changes from lua/lua@ca41b43f and lua/lua@9514abc2. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #16541 Closes #16583
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/*
|
|
** $Id: lstring.h,v 1.49.1.1 2013/04/12 18:48:47 roberto Exp $
|
|
** String table (keep all strings handled by Lua)
|
|
** See Copyright Notice in lua.h
|
|
*/
|
|
|
|
#ifndef lstring_h
|
|
#define lstring_h
|
|
|
|
#include "lgc.h"
|
|
#include "lobject.h"
|
|
#include "lstate.h"
|
|
|
|
|
|
#define sizestring(s) (sizeof(struct TString)+((s)->len+1)*sizeof(char))
|
|
|
|
#define sizeudata(u) (sizeof(union Udata)+(u)->len)
|
|
|
|
#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
|
|
(sizeof(s)/sizeof(char))-1))
|
|
|
|
#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT)
|
|
|
|
|
|
/*
|
|
** test whether a string is a reserved word
|
|
*/
|
|
#define isreserved(s) ((s)->tsv.tt == LUA_TSHRSTR && (s)->tsv.extra > 0)
|
|
|
|
|
|
/*
|
|
** equality for short strings, which are always internalized
|
|
*/
|
|
#define eqshrstr(a,b) check_exp((a)->tsv.tt == LUA_TSHRSTR, (a) == (b))
|
|
|
|
|
|
LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
|
|
LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
|
|
LUAI_FUNC int luaS_eqstr (TString *a, TString *b);
|
|
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
|
|
LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
|
|
LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
|
|
LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
|
|
|
|
|
|
#endif
|