You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: C/C++ Function Pointer Return Types Misalign Argument Block #1854
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginepriority: mediumtestingUnit, integration, and E2E pipeline verification
Bug: C/C++ Function Pointer Return Types Misalign Argument Block
Description
In gitgalaxy/core/detector.py, the _count_top_level_args parses the argument string by assuming the parameter list starts after the first open parenthesis it encounters:
For standard function signatures (e.g. int foo(int a, int b)), this reliably isolates the parameter block. However, if a C or C++ function returns a function pointer, the function name is wrapped in a parenthesis (e.g., void (*foo(int a, int b))(int c)).
Impact
The .find("(") logic incorrectly locks onto the opening parenthesis of the return type block ((*foo...).
The resulting body string ends up being truncated incorrectly (e.g., *foo(int a, int b), creating an unbalanced open parenthesis. All commas inside this misaligned block are treated as having depth = 1 and are therefore hidden from the argument counter.
Steps to Reproduce
Test with the signature: void (*foo(int a, int b))(int c)
Observe that the returned argument count is 0 instead of 2.
Suggested Fix
Improve the bounding logic for C-family languages to detect function pointer syntax and skip to the correct parameter parenthesis, or use treat_as_body=True for these specific signatures so the regex handles the precise capture.
Fixed in #1884 (merged). _count_top_level_args now detects the function-pointer-return shape (void (*foo(int a, int b))(int c), incl. the pointer-to-member form) and re-slices to the correct inner (. Verified: all three repro signatures now return 2. Regression tests test_count_top_level_args_function_pointer_return_type_1854 and test_count_top_level_args_function_pointer_edge_cases_1854_review pass on current main.
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginepriority: mediumtestingUnit, integration, and E2E pipeline verification
Activity
Correct overclaim in c.md, cross-reference pre-existing args issues, …
Fix 4 C/C++ arg-count extraction bugs in detector.py (#1884)
squid-protocol commentedon Aug 28, 2026
Fixed in #1884 (merged).
_count_top_level_argsnow detects the function-pointer-return shape (void (*foo(int a, int b))(int c), incl. the pointer-to-member form) and re-slices to the correct inner(. Verified: all three repro signatures now return 2. Regression teststest_count_top_level_args_function_pointer_return_type_1854andtest_count_top_level_args_function_pointer_edge_cases_1854_reviewpass on current main.