{
"lapi.c": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 35,
"message": "Variable 'lua_ident' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 35,
"message": "File-scope variable should have minimal scope. Consider making it static within a function or limiting its scope.",
"rule_id": "DCL19-C",
"severity": "Low",
"suggestion": "Move variable to the smallest scope where it's used, or make it static inside a function"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 109,
"message": "Function 'lua_checkstack' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 109,
"message": "Function 'lua_checkstack' does not validate integer parameter 'n' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'n' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 109,
"message": "Function 'lua_checkstack' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_checkstack"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 126,
"message": "Function 'lua_xmove' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_xmove"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 142,
"message": "Function 'lua_CFunction' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 152,
"message": "Function 'lua_version' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_version"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 167,
"message": "Function 'lua_absindex' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 167,
"message": "Function 'lua_absindex' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_absindex"
},
{
"column": 37,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 167,
"message": "Pointer parameter 'L' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *L'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 174,
"message": "Function 'lua_gettop' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 174,
"message": "Function 'lua_gettop' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_gettop"
},
{
"column": 35,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 174,
"message": "Pointer parameter 'L' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *L'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 179,
"message": "Function 'lua_settop' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 179,
"message": "Function 'lua_settop' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_settop"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 206,
"message": "Function 'lua_closeslot' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 206,
"message": "Function 'lua_closeslot' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_closeslot"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 207,
"message": "Variable 'level' should be declared volatile - modified around function calls that may have external side effects",
"rule_id": "DCL22-C",
"severity": "Low",
"suggestion": "Declare as 'volatile' to prevent compiler optimizations that assume variable state is unchanged across function calls"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 238,
"message": "Function 'lua_rotate' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 238,
"message": "Function 'lua_rotate' does not validate integer parameter 'n' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'n' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 238,
"message": "Function 'lua_rotate' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rotate"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 253,
"message": "Function 'lua_copy' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 253,
"message": "Function 'lua_copy' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_copy"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 268,
"message": "Function 'lua_pushvalue' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 268,
"message": "Function 'lua_pushvalue' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushvalue"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 282,
"message": "Function 'lua_type' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 282,
"message": "Function 'lua_type' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_type"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 288,
"message": "Function 'lua_typename' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 295,
"message": "Function 'lua_iscfunction' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 295,
"message": "Function 'lua_iscfunction' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_iscfunction"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 301,
"message": "Function 'lua_isinteger' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 301,
"message": "Function 'lua_isinteger' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_isinteger"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 307,
"message": "Function 'lua_isnumber' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 307,
"message": "Function 'lua_isnumber' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_isnumber"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 314,
"message": "Function 'lua_isstring' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 314,
"message": "Function 'lua_isstring' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_isstring"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 320,
"message": "Function 'lua_isuserdata' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 320,
"message": "Function 'lua_isuserdata' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_isuserdata"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 326,
"message": "Function 'lua_rawequal' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 326,
"message": "Function 'lua_rawequal' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rawequal"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 333,
"message": "Function 'lua_arith' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 333,
"message": "Function 'lua_arith' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_arith"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 343,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 349,
"message": "Function 'lua_compare' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 349,
"message": "Function 'lua_compare' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_compare"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 369,
"message": "Function 'lua_numbertocstring' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 369,
"message": "Function 'lua_numbertocstring' does not validate pointer parameter 'buff' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'buff' at the start of the function, e.g., 'if (!buff) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 381,
"message": "Function 'lua_stringtonumber' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 381,
"message": "Function 'lua_stringtonumber' does not validate pointer parameter 's' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 's' at the start of the function, e.g., 'if (!s) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 381,
"message": "Function 'lua_stringtonumber' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_stringtonumber"
},
{
"column": 28,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 382,
"message": "'s' (signed/plain char) converted to larger integer type without cast to 'unsigned char' - may cause sign extension",
"rule_id": "STR34-C",
"severity": "Medium",
"suggestion": "Cast to 'unsigned char' before conversion to larger type"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 389,
"message": "Function 'lua_tonumberx' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 389,
"message": "Function 'lua_tonumberx' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_tonumberx"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 399,
"message": "Function 'lua_tointegerx' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 399,
"message": "Function 'lua_tointegerx' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_tointegerx"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 409,
"message": "Function 'lua_toboolean' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 409,
"message": "Function 'lua_toboolean' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_toboolean"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 437,
"message": "Function 'lua_Unsigned' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 455,
"message": "Function 'lua_tocfunction' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 455,
"message": "Function 'lua_tocfunction' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_tocfunction"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 464,
"message": "Function 'touserdata' does not validate pointer parameter 'o' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'o' at the start of the function, e.g., 'if (!o) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 464,
"message": "Function 'touserdata' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static l_sinline touserdata"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 473,
"message": "Function 'lua_touserdata' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 479,
"message": "Function 'lua_tothread' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 492,
"message": "Function 'lua_topointer' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 514,
"message": "Function 'lua_pushnil' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 514,
"message": "Function 'lua_pushnil' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushnil"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 522,
"message": "Function 'lua_pushnumber' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 522,
"message": "Function 'lua_pushnumber' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushnumber"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 530,
"message": "Function 'lua_pushinteger' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 530,
"message": "Function 'lua_pushinteger' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushinteger"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 543,
"message": "Function 'lua_pushlstring' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 543,
"message": "Function 'lua_pushlstring' does not validate pointer parameter 's' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 's' at the start of the function, e.g., 'if (!s) { return error_code; }'"
},
{
"column": 63,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 543,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 555,
"message": "Function 'lua_pushexternalstring' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 555,
"message": "Function 'lua_pushexternalstring' does not validate pointer parameter 's' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 's' at the start of the function, e.g., 'if (!s) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 555,
"message": "Function 'lua_pushexternalstring' does not validate pointer parameter 'ud' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'ud' at the start of the function, e.g., 'if (!ud) { return error_code; }'"
},
{
"column": 21,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 556,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 60,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 556,
"message": "Pointer parameter should use conformant array syntax",
"rule_id": "API05-C",
"severity": "High",
"suggestion": "Use conformant array parameter syntax (e.g., 'char p[n]') with the size parameter declared before the array"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 570,
"message": "Function 'lua_pushstring' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 6,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 572,
"message": "Direct NULL check for pointer validation. Define and use a dedicated pointer validation function instead of ad-hoc NULL checks. This centralizes validation logic and allows platform-specific enhancements.",
"rule_id": "MEM10-C",
"severity": "Medium",
"suggestion": "Create a validation function like 'int valid(void *ptr)' and use 'if (!valid(ptr))' instead of 'if (ptr == NULL)'"
},
{
"column": 10,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 576,
"message": "Memory allocated with 'luaS_new' for variable 'ts' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(ts)' before the variable goes out of scope"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 583,
"message": "Memory leak: 'ts' allocated with 'luaS_new' is not freed before return",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Free 'ts' before this return statement"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 587,
"message": "Function 'lua_pushvfstring' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 587,
"message": "Function 'lua_pushvfstring' does not validate pointer parameter 'fmt' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'fmt' at the start of the function, e.g., 'if (!fmt) { return error_code; }'"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 594,
"message": "Function returns pointer to local variable 'ret' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 598,
"message": "Function 'lua_pushfstring' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 598,
"message": "Function 'lua_pushfstring' does not validate pointer parameter 'fmt' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'fmt' at the start of the function, e.g., 'if (!fmt) { return error_code; }'"
},
{
"column": 19,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 602,
"message": "Variable 'argp' is used uninitialized",
"rule_id": "EXP33-C",
"severity": "High",
"suggestion": "Initialize 'argp' before use, e.g., at its declaration"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 605,
"message": "Function returns pointer to local variable 'ret' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 609,
"message": "Function 'lua_pushcclosure' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 609,
"message": "Function 'lua_pushcclosure' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushcclosure"
},
{
"column": 5,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 621,
"message": "Potential null pointer dereference in member access of variable 'cl'",
"rule_id": "EXP34-C",
"severity": "High",
"suggestion": "Check if 'cl' is not NULL before member access"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 636,
"message": "Function 'lua_pushboolean' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 636,
"message": "Function 'lua_pushboolean' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushboolean"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 647,
"message": "Function 'lua_pushlightuserdata' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 647,
"message": "Function 'lua_pushlightuserdata' does not validate pointer parameter 'p' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'p' at the start of the function, e.g., 'if (!p) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 647,
"message": "Function 'lua_pushlightuserdata' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushlightuserdata"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 655,
"message": "Function 'lua_pushthread' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 655,
"message": "Function 'lua_pushthread' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pushthread"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 657,
"message": "Function 'setthvalue' called with same pointer for output and input parameters. If output parameter is non-const restrict, this causes undefined behavior.",
"rule_id": "EXP43-C",
"severity": "High",
"suggestion": "Ensure output restrict parameter receives a unique pointer"
},
{
"column": 18,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 672,
"message": "Memory allocated with 'luaS_new' for variable 'str' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(str)' before the variable goes out of scope"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 682,
"message": "Memory leak: 'str' allocated with 'luaS_new' is not freed before return",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Free 'str' before this return statement"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 699,
"message": "Function 'lua_getglobal' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 699,
"message": "Function 'lua_getglobal' does not validate pointer parameter 'name' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'name' at the start of the function, e.g., 'if (!name) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 699,
"message": "Function 'lua_getglobal' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_getglobal"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 707,
"message": "Function 'lua_gettable' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 707,
"message": "Function 'lua_gettable' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_gettable"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 713,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 721,
"message": "Function 'lua_getfield' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 721,
"message": "Function 'lua_getfield' does not validate pointer parameter 'k' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'k' at the start of the function, e.g., 'if (!k) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 721,
"message": "Function 'lua_getfield' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_getfield"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 727,
"message": "Function 'lua_geti' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 727,
"message": "Function 'lua_geti' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_geti"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 753,
"message": "Function 'gettable' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 753,
"message": "Function 'gettable' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static l_sinline gettable"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 760,
"message": "Function 'lua_rawget' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 760,
"message": "Function 'lua_rawget' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rawget"
},
{
"column": 9,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 766,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 772,
"message": "Function 'lua_rawgeti' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 772,
"message": "Function 'lua_rawgeti' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rawgeti"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 782,
"message": "Function 'lua_rawgetp' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 782,
"message": "Function 'lua_rawgetp' does not validate pointer parameter 'p' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'p' at the start of the function, e.g., 'if (!p) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 782,
"message": "Function 'lua_rawgetp' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rawgetp"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 792,
"message": "Function 'lua_createtable' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 792,
"message": "Function 'lua_createtable' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_createtable"
},
{
"column": 7,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 795,
"message": "Memory allocated with 'luaH_new' for variable 't' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(t)' before the variable goes out of scope"
},
{
"column": 5,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 799,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 805,
"message": "Function 'lua_getmetatable' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 805,
"message": "Function 'lua_getmetatable' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_getmetatable"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 832,
"message": "Function 'lua_getiuservalue' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 832,
"message": "Function 'lua_getiuservalue' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_getiuservalue"
},
{
"column": 18,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 861,
"message": "Memory allocated with 'luaS_new' for variable 'str' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(str)' before the variable goes out of scope"
},
{
"column": 5,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 871,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 878,
"message": "Function 'lua_setglobal' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 878,
"message": "Function 'lua_setglobal' does not validate pointer parameter 'name' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'name' at the start of the function, e.g., 'if (!name) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 878,
"message": "Function 'lua_setglobal' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_setglobal"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 886,
"message": "Function 'lua_settable' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 886,
"message": "Function 'lua_settable' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_settable"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 892,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 5,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 896,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 902,
"message": "Function 'lua_setfield' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 902,
"message": "Function 'lua_setfield' does not validate pointer parameter 'k' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'k' at the start of the function, e.g., 'if (!k) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 902,
"message": "Function 'lua_setfield' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_setfield"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 908,
"message": "Function 'lua_seti' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 908,
"message": "Function 'lua_seti' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_seti"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 934,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 940,
"message": "Function 'lua_rawset' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 940,
"message": "Function 'lua_rawset' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rawset"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 945,
"message": "Function 'lua_rawsetp' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 945,
"message": "Function 'lua_rawsetp' does not validate pointer parameter 'p' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'p' at the start of the function, e.g., 'if (!p) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 945,
"message": "Function 'lua_rawsetp' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rawsetp"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 952,
"message": "Function 'lua_rawseti' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 952,
"message": "Function 'lua_rawseti' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_rawseti"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 958,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 964,
"message": "Function 'lua_setmetatable' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 964,
"message": "Function 'lua_setmetatable' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_setmetatable"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1004,
"message": "Function 'lua_setiuservalue' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1004,
"message": "Function 'lua_setiuservalue' does not validate integer parameter 'n' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'n' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1004,
"message": "Function 'lua_setiuservalue' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_setiuservalue"
},
{
"column": 5,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1015,
"message": "Multiple function calls with potential side effects in unsequenced arguments",
"rule_id": "EXP30-C",
"severity": "High",
"suggestion": "Evaluate function calls in separate statements to guarantee ordering"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1029,
"message": "Function-like macro 'checkresults' evaluates parameter(s) multiple times; prefer inline or static functions for type safety",
"rule_id": "PRE00-C",
"severity": "Low",
"suggestion": null
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1029,
"message": "Macro parameter 'L' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'L' in parentheses: (L) instead of L"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1029,
"message": "Macro evaluates parameter 'L' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1037,
"message": "Function 'lua_callk' does not validate integer parameter 'nargs' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'nargs' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1037,
"message": "Function 'lua_callk' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_callk"
},
{
"column": 40,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1069,
"message": "Pointer parameter 'ud' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ud'"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1070,
"message": "Variable 'c' is initialized but never modified, consider const-qualifying it",
"rule_id": "DCL00-C",
"severity": "Medium",
"suggestion": "Add 'const' qualifier: const c = ..."
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1076,
"message": "Function 'lua_pcallk' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1076,
"message": "Function 'lua_pcallk' does not validate integer parameter 'nargs' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'nargs' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1076,
"message": "Function 'lua_pcallk' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_pcallk"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1120,
"message": "Function 'lua_load' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1120,
"message": "Function 'lua_load' does not validate pointer parameter 'data' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'data' at the start of the function, e.g., 'if (!data) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1120,
"message": "Function 'lua_load' does not validate pointer parameter 'chunkname' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'chunkname' at the start of the function, e.g., 'if (!chunkname) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1120,
"message": "Function 'lua_load' does not validate pointer parameter 'mode' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'mode' at the start of the function, e.g., 'if (!mode) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1120,
"message": "Function 'lua_load' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_load"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1149,
"message": "Function 'lua_dump' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1149,
"message": "Function 'lua_dump' does not validate pointer parameter 'data' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'data' at the start of the function, e.g., 'if (!data) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1149,
"message": "Function 'lua_dump' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_dump"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1163,
"message": "Function 'lua_status' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1163,
"message": "Function 'lua_status' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_status"
},
{
"column": 35,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1163,
"message": "Pointer parameter 'L' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *L'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1171,
"message": "Function 'lua_gc' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_gc"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1174,
"message": "Variable 'g' is initialized but never modified, consider const-qualifying it",
"rule_id": "DCL00-C",
"severity": "Medium",
"suggestion": "Add 'const' qualifier: const g = ..."
},
{
"column": 7,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1175,
"message": "Variable 'g' used with both bitwise and arithmetic operations (reduces code readability)",
"rule_id": "INT14-C",
"severity": "Medium",
"suggestion": "Use separate variables for bitwise and arithmetic operations, or refactor to use only arithmetic operators"
},
{
"column": 22,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1195,
"message": "Do not assume constant values in expressions: 'gettotalbytes(g) >> 10'",
"rule_id": "EXP07-C",
"severity": "Low",
"suggestion": "Use the constant identifier directly instead of assuming its numeric value"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1258,
"message": "Function 'lua_error' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1258,
"message": "Function 'lua_error' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_error"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1273,
"message": "Function 'lua_next' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1273,
"message": "Function 'lua_next' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_next"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1289,
"message": "Function 'lua_toclose' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1289,
"message": "Function 'lua_toclose' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_toclose"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1300,
"message": "Function 'lua_concat' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1300,
"message": "Function 'lua_concat' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_concat"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1315,
"message": "Function 'lua_len' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1315,
"message": "Function 'lua_len' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_len"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1325,
"message": "Function 'lua_getallocf' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1325,
"message": "Function 'lua_getallocf' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_getallocf"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1335,
"message": "Function 'lua_setallocf' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1335,
"message": "Function 'lua_setallocf' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_setallocf"
},
{
"column": 61,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1335,
"message": "Pointer parameter 'ud' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ud'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1343,
"message": "Function 'lua_setwarnf' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1343,
"message": "Function 'lua_setwarnf' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static void lua_setwarnf"
},
{
"column": 59,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1343,
"message": "Pointer parameter 'ud' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ud'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1351,
"message": "Function 'lua_warning' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1351,
"message": "Function 'lua_warning' does not validate pointer parameter 'msg' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'msg' at the start of the function, e.g., 'if (!msg) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1351,
"message": "Function 'lua_warning' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static void lua_warning"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1359,
"message": "Function 'lua_newuserdatauv' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 7,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1380,
"message": "Direct assignment of flexible array structure instances. Use memcpy() for dynamic copying.",
"rule_id": "MEM33-C",
"severity": "High",
"suggestion": "Use memcpy() to copy the structure and its flexible array member"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1400,
"message": "Function 'lua_getupvalue' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1400,
"message": "Function 'lua_getupvalue' does not validate integer parameter 'n' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'n' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1410,
"message": "Function returns pointer to local variable 'name' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1414,
"message": "Function 'lua_setupvalue' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1414,
"message": "Function 'lua_setupvalue' does not validate integer parameter 'n' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'n' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1429,
"message": "Function returns pointer to local variable 'name' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
},
{
"column": 11,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1439,
"message": "Local variable 'f' assigned through pointer parameter - address will be invalid when function returns",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Copy data instead of assigning pointer, or use static/allocated storage"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1447,
"message": "Function 'lua_upvalueid' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1447,
"message": "Function 'lua_upvalueid' does not validate integer parameter 'n' for overflow before arithmetic operations",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add overflow validation for 'n' before arithmetic, e.g., check against INT_MAX/INT_MIN or use __builtin_*_overflow()"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1469,
"message": "Function 'lua_upvaluejoin' does not validate pointer parameter 'L' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'L' at the start of the function, e.g., 'if (!L) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1469,
"message": "Function 'lua_upvaluejoin' should be declared static if it doesn't need external linkage",
"rule_id": "DCL15-C",
"severity": "Low",
"suggestion": "Add 'static' storage-class specifier: static LUA_API lua_upvaluejoin"
},
{
"column": 9,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1472,
"message": "Pointer-to-pointer assignment may allow const circumvention: **up1 = getupvalref(L, fidx1, n1, &f1): '**up1 = getupvalref(L, fidx1, n1, &f1)'",
"rule_id": "EXP40-C",
"severity": "Low",
"suggestion": "Either remove const qualifier if the object should be modifiable, or use explicit casts to show intentional const removal"
},
{
"column": 16,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1474,
"message": "Potential null pointer dereference of variable 'up1'",
"rule_id": "EXP34-C",
"severity": "High",
"suggestion": "Check if 'up1' is not NULL before dereferencing"
},
{
"column": 32,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1474,
"message": "Potential null pointer dereference of variable 'up2'",
"rule_id": "EXP34-C",
"severity": "High",
"suggestion": "Check if 'up2' is not NULL before dereferencing"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1475,
"message": "Direct assignment of flexible array structure instances. Use memcpy() for dynamic copying.",
"rule_id": "MEM33-C",
"severity": "High",
"suggestion": "Use memcpy() to copy the structure and its flexible array member"
},
{
"column": 22,
"file": "/home/brandon/toolchain/lua/lapi.c",
"line": 1476,
"message": "Variable 'f1' is used uninitialized",
"rule_id": "EXP33-C",
"severity": "High",
"suggestion": "Initialize 'f1' before use, e.g., at its declaration"
}
]
}