{
"lparser.c": [
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 38,
"message": "Function-like macro 'hasmultret' 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/lparser.c",
"line": 38,
"message": "Macro evaluates parameter 'k' 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/lparser.c",
"line": 68,
"message": "Non-void function has no return statement. Control reaching the end of a non-void function without returning a value is undefined behavior.",
"rule_id": "MSC37-C",
"severity": "Medium",
"suggestion": "Add a return statement on all execution paths of this function"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 74,
"message": "Non-void function has no return statement. Control reaching the end of a non-void function without returning a value is undefined behavior.",
"rule_id": "MSC37-C",
"severity": "Medium",
"suggestion": "Add a return statement on all execution paths of this function"
},
{
"column": 38,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 74,
"message": "Pointer parameter 'fs' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *fs'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 122,
"message": "Multistatement macro 'check_condition' is not wrapped in a do-while loop. This can cause issues when used in if statements without braces",
"rule_id": "PRE10-C",
"severity": "Medium",
"suggestion": "Wrap the macro body in: do { /* statements */ } while (0)"
},
{
"column": 28,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 135,
"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": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 148,
"message": "Function returns pointer to local variable 'ts' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
},
{
"column": 45,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 159,
"message": "Pointer parameter 's' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *s'"
},
{
"column": 41,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 175,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 34,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 194,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 47,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 194,
"message": "Pointer parameter 'name' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *name'"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 199,
"message": "Function 'luaM_growvector' called with overlapping memory regions. If parameters are restrict-qualified, this causes undefined behavior.",
"rule_id": "EXP43-C",
"severity": "High",
"suggestion": "Ensure memory regions do not overlap when using restrict pointers"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 215,
"message": "Function-like macro 'new_localvarliteral' 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/lparser.c",
"line": 215,
"message": "Macro replacement list should be parenthesized to prevent operator precedence issues.",
"rule_id": "PRE02-C",
"severity": "Medium",
"suggestion": "Wrap the entire replacement list in parentheses: (new_localvar(ls, \\\n luaX_newstring(ls, \"\" v, (sizeof(v)/sizeof(char)) - 1));)"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 215,
"message": "Macro 'new_localvarliteral' definition ends with a semicolon. This can cause unexpected behavior when the macro is used.",
"rule_id": "PRE11-C",
"severity": "Medium",
"suggestion": "Remove the trailing semicolon from the macro definition. The semicolon should be added by the macro user, not in the definition."
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 215,
"message": "Macro evaluates parameter 'ls' multiple times; use inline function instead",
"rule_id": "PRE12-C",
"severity": "Medium",
"suggestion": "Replace macro with inline function to avoid multiple evaluation"
},
{
"column": 44,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 226,
"message": "Pointer parameter 'fs' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *fs'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 250,
"message": "Function 'luaY_nvarstack' does not validate pointer parameter 'fs' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'fs' at the start of the function, e.g., 'if (!fs) { return error_code; }'"
},
{
"column": 37,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 360,
"message": "Pointer parameter 'fs' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *fs'"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 373,
"message": "Function 'luaY_checklimit' called with overlapping memory regions. If parameters are restrict-qualified, this causes undefined behavior.",
"rule_id": "EXP43-C",
"severity": "High",
"suggestion": "Ensure memory regions do not overlap when using restrict pointers"
},
{
"column": 62,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 382,
"message": "Pointer parameter 'v' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *v'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 476,
"message": "Recursive function can cause excessive stack allocation",
"rule_id": "MEM05-C",
"severity": "Medium",
"suggestion": "Consider iterative approach or limit recursion depth"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 476,
"message": "Function 'singlevaraux' calls itself directly (direct recursion)",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to use iteration instead of recursion"
},
{
"column": 37,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 547,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 570,
"message": "Macro parameter 'ls' is not parenthesized in replacement text. This can cause operator precedence issues.",
"rule_id": "PRE01-C",
"severity": "Medium",
"suggestion": "Wrap parameter 'ls' in parentheses: (ls) instead of ls"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 573,
"message": "Function-like macro 'leavelevel' 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/lparser.c",
"line": 580,
"message": "Non-void function has no return statement. Control reaching the end of a non-void function without returning a value is undefined behavior.",
"rule_id": "MSC37-C",
"severity": "Medium",
"suggestion": "Add a return statement on all execution paths of this function"
},
{
"column": 56,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 580,
"message": "Pointer parameter 'gt' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *gt'"
},
{
"column": 55,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 597,
"message": "Pointer parameter 'label' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *label'"
},
{
"column": 20,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 601,
"message": "Array subscript uses function parameter 'g' without bounds checking. Caller could pass invalid index.",
"rule_id": "ARR00-C",
"severity": "Medium",
"suggestion": "Add bounds checking for 'g' before using it as an array index"
},
{
"column": 27,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 611,
"message": "Memory allocated with 'CREATE_ABCk' for variable 'fs->f->code[gt->pc]' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(fs->f->code[gt->pc])' before the variable goes out of scope"
},
{
"column": 39,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 626,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 628,
"message": "Loop uses uninitialized variable 'ilb' as bound for array access. This has indeterminate value and can cause out-of-bounds access.",
"rule_id": "ARR00-C",
"severity": "Medium",
"suggestion": "Initialize 'ilb' to a valid value before using it in the loop"
},
{
"column": 36,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 640,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 63,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 640,
"message": "Pointer parameter 'name' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *name'"
},
{
"column": 49,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 696,
"message": "Pointer parameter 'bl' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *bl'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 737,
"message": "Non-void function has no return statement. Control reaching the end of a non-void function without returning a value is undefined behavior.",
"rule_id": "MSC37-C",
"severity": "Medium",
"suggestion": "Add a return statement on all execution paths of this function"
},
{
"column": 51,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 737,
"message": "Pointer parameter 'gt' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *gt'"
},
{
"column": 38,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 768,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 781,
"message": "Function returns pointer to local variable 'clp' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
},
{
"column": 35,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 792,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 16,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 823,
"message": "Memory allocated with 'luaH_new' for variable 'fs->kcache' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(fs->kcache)' before the variable goes out of scope"
},
{
"column": 35,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 866,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 877,
"message": "Function 'statlist' participates in indirect recursion: statlist -> statement -> localstat -> explist -> expr -> subexpr -> simpleexp -> body -> statlist",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 900,
"message": "Function 'yindex' participates in indirect recursion: yindex -> expr -> subexpr -> simpleexp -> suffixedexp -> funcargs -> constructor -> field -> recfield -> yindex",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 938,
"message": "Function 'recfield' participates in indirect recursion: recfield -> yindex -> expr -> subexpr -> simpleexp -> suffixedexp -> funcargs -> constructor -> field -> recfield",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 985,
"message": "Function 'listfield' participates in indirect recursion: listfield -> expr -> subexpr -> simpleexp -> suffixedexp -> funcargs -> constructor -> field -> listfield",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 992,
"message": "Function 'field' participates in indirect recursion: field -> recfield -> expr -> subexpr -> simpleexp -> suffixedexp -> funcargs -> constructor -> field",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1019,
"message": "Non-void function may reach end without returning a value. Ensure all execution paths have explicit return statements.",
"rule_id": "MSC37-C",
"severity": "Medium",
"suggestion": "Add return statements to ensure all execution paths return a value"
},
{
"column": 34,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1019,
"message": "Pointer parameter 'fs' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *fs'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1030,
"message": "Function 'constructor' participates in indirect recursion: constructor -> field -> listfield -> expr -> subexpr -> simpleexp -> suffixedexp -> funcargs -> constructor",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1105,
"message": "Function 'body' participates in indirect recursion: body -> statlist -> statement -> localstat -> explist -> expr -> subexpr -> simpleexp -> body",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1127,
"message": "Function 'explist' participates in indirect recursion: explist -> expr -> subexpr -> simpleexp -> suffixedexp -> funcargs -> explist",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1140,
"message": "Function 'funcargs' participates in indirect recursion: funcargs -> explist -> expr -> subexpr -> simpleexp -> suffixedexp -> funcargs",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 24,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1152,
"message": "Variable 'args' is used uninitialized",
"rule_id": "EXP33-C",
"severity": "High",
"suggestion": "Initialize 'args' before use, e.g., at its declaration"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1198,
"message": "Function 'primaryexp' participates in indirect recursion: primaryexp -> expr -> subexpr -> simpleexp -> suffixedexp -> primaryexp",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1220,
"message": "Function 'suffixedexp' participates in indirect recursion: suffixedexp -> yindex -> expr -> subexpr -> simpleexp -> suffixedexp",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1257,
"message": "Function 'simpleexp' participates in indirect recursion: simpleexp -> constructor -> field -> listfield -> expr -> subexpr -> simpleexp",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1357,
"message": "Array declaration 'priority[]' has implicit bounds; specify explicit size",
"rule_id": "ARR02-C",
"severity": "Medium",
"suggestion": "Explicitly specify array bounds even when using an initializer"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1377,
"message": "Recursive function can cause excessive stack allocation",
"rule_id": "MEM05-C",
"severity": "Medium",
"suggestion": "Consider iterative approach or limit recursion depth"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1377,
"message": "Function 'subexpr' calls itself directly (direct recursion)",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to use iteration instead of recursion"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1407,
"message": "Function 'expr' participates in indirect recursion: expr -> subexpr -> simpleexp -> suffixedexp -> funcargs -> constructor -> field -> listfield -> expr",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1422,
"message": "Function 'block' participates in indirect recursion: block -> statlist -> statement -> ifstat -> block",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 38,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1448,
"message": "Pointer parameter 'ls' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *ls'"
},
{
"column": 74,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1448,
"message": "Pointer parameter 'v' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *v'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1501,
"message": "Recursive function can cause excessive stack allocation",
"rule_id": "MEM05-C",
"severity": "Medium",
"suggestion": "Consider iterative approach or limit recursion depth"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1501,
"message": "Function 'restassign' calls itself directly (direct recursion)",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to use iteration instead of recursion"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1531,
"message": "Function 'cond' participates in indirect recursion: cond -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> repeatstat -> cond",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1558,
"message": "Potential null pointer dereference in member access of variable 'bl'",
"rule_id": "EXP34-C",
"severity": "High",
"suggestion": "Check if 'bl' is not NULL before member access"
},
{
"column": 37,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1572,
"message": "Potential null pointer dereference in member access of variable 'lb'",
"rule_id": "EXP34-C",
"severity": "High",
"suggestion": "Check if 'lb' is not NULL before member access"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1576,
"message": "Function 'labelstat' participates in indirect recursion: labelstat -> statement -> labelstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1586,
"message": "Function 'whilestat' participates in indirect recursion: whilestat -> block -> statlist -> statement -> whilestat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1605,
"message": "Function 'repeatstat' participates in indirect recursion: repeatstat -> cond -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> repeatstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1635,
"message": "Function 'exp1' participates in indirect recursion: exp1 -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> forstat -> fornum -> exp1",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 35,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1648,
"message": "Pointer parameter 'fs' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *fs'"
},
{
"column": 23,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1649,
"message": "Array subscript uses function parameter 'pc' without bounds checking. Caller could pass invalid index.",
"rule_id": "ARR00-C",
"severity": "Medium",
"suggestion": "Add bounds checking for 'pc' before using it as an array index"
},
{
"column": 23,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1649,
"message": "Potentially unsafe array access with unvalidated function parameter index 'pc'",
"rule_id": "ARR30-C",
"severity": "High",
"suggestion": "Add bounds checking for function parameter before using as array index."
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1662,
"message": "Function 'forbody' participates in indirect recursion: forbody -> block -> statlist -> statement -> forstat -> forlist -> forbody",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 27,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1670,
"message": "Array subscript uses function parameter 'isgen' without bounds checking. Caller could pass invalid index.",
"rule_id": "ARR00-C",
"severity": "Medium",
"suggestion": "Add bounds checking for 'isgen' before using it as an array index"
},
{
"column": 29,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1682,
"message": "Array subscript uses function parameter 'isgen' without bounds checking. Caller could pass invalid index.",
"rule_id": "ARR00-C",
"severity": "Medium",
"suggestion": "Add bounds checking for 'isgen' before using it as an array index"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1697,
"message": "Function 'fornum' participates in indirect recursion: fornum -> forbody -> block -> statlist -> statement -> forstat -> fornum",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1719,
"message": "Function 'forlist' participates in indirect recursion: forlist -> forbody -> block -> statlist -> statement -> forstat -> forlist",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1746,
"message": "Function 'forstat' participates in indirect recursion: forstat -> forlist -> explist -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> forstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1764,
"message": "Function 'test_then_block' participates in indirect recursion: test_then_block -> cond -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> ifstat -> test_then_block",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1779,
"message": "Function 'ifstat' participates in indirect recursion: ifstat -> test_then_block -> block -> statlist -> statement -> ifstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1793,
"message": "Function 'localfunc' participates in indirect recursion: localfunc -> body -> statlist -> statement -> localfunc",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1830,
"message": "Function 'localstat' participates in indirect recursion: localstat -> explist -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> localstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 12,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1844,
"message": "Memory allocated with 'new_varkind' for variable 'vidx' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(vidx)' before the variable goes out of scope"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1906,
"message": "Recursive function can cause excessive stack allocation",
"rule_id": "MEM05-C",
"severity": "Medium",
"suggestion": "Consider iterative approach or limit recursion depth"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1906,
"message": "Function 'initglobal' calls itself directly (direct recursion)",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to use iteration instead of recursion"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1927,
"message": "Function 'globalnames' participates in indirect recursion: globalnames -> initglobal -> explist -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> globalstatfunc -> globalstat -> globalnames",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 15,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1934,
"message": "Memory allocated with 'new_varkind' for variable 'lastidx' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(lastidx)' before the variable goes out of scope"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1943,
"message": "Function 'globalstat' participates in indirect recursion: globalstat -> globalnames -> initglobal -> explist -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> globalstatfunc -> globalstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1959,
"message": "Function 'globalfunc' participates in indirect recursion: globalfunc -> body -> statlist -> statement -> globalstatfunc -> globalfunc",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1974,
"message": "Function 'globalstatfunc' participates in indirect recursion: globalstatfunc -> globalfunc -> body -> statlist -> statement -> globalstatfunc",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 1998,
"message": "Function 'funcstat' participates in indirect recursion: funcstat -> body -> statlist -> statement -> funcstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2011,
"message": "Function 'exprstat' participates in indirect recursion: exprstat -> restassign -> explist -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> exprstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 20,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2015,
"message": "Variable 'v' is used uninitialized",
"rule_id": "EXP33-C",
"severity": "High",
"suggestion": "Initialize 'v' before use, e.g., at its declaration"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2029,
"message": "Function 'retstat' participates in indirect recursion: retstat -> explist -> expr -> subexpr -> simpleexp -> body -> statlist -> statement -> retstat",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2061,
"message": "Function 'statement' participates in indirect recursion: statement -> block -> statlist -> statement",
"rule_id": "MSC04-C",
"severity": "Medium",
"suggestion": "Refactor to eliminate the recursion cycle"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2180,
"message": "Function 'luaY_parser' 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/lparser.c",
"line": 2180,
"message": "Function 'luaY_parser' does not validate pointer parameter 'z' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'z' at the start of the function, e.g., 'if (!z) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2180,
"message": "Function 'luaY_parser' does not validate pointer parameter 'anchor' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'anchor' at the start of the function, e.g., 'if (!anchor) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2180,
"message": "Function 'luaY_parser' 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/lparser.c",
"line": 2180,
"message": "Function 'luaY_parser' does not validate pointer parameter 'dyd' before use",
"rule_id": "API00-C",
"severity": "Medium",
"suggestion": "Add validation check for 'dyd' at the start of the function, e.g., 'if (!dyd) { return error_code; }'"
},
{
"column": 1,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2180,
"message": "Function 'luaY_parser' 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": 69,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2180,
"message": "Pointer parameter 'buff' is not modified and should be declared const",
"rule_id": "DCL13-C",
"severity": "Low",
"suggestion": "Declare parameter as 'const <type> *buff'"
},
{
"column": 17,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2188,
"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": 25,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2190,
"message": "Memory allocated with 'luaS_new' for variable 'funcstate.f->source' is not freed",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Add 'free(funcstate.f->source)' before the variable goes out of scope"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2200,
"message": "Function returns pointer to local variable 'cl' with automatic storage duration",
"rule_id": "DCL30-C",
"severity": "High",
"suggestion": "Use static storage, allocated memory, or pass output buffer as parameter"
},
{
"column": 3,
"file": "/home/brandon/toolchain/lua/lparser.c",
"line": 2200,
"message": "Memory leak: 'funcstate.f->source' allocated with 'luaS_new' is not freed before return",
"rule_id": "MEM31-C",
"severity": "High",
"suggestion": "Free 'funcstate.f->source' before this return statement"
}
]
}