Repository navigation
Description
[Sub-Issue] Implement C/C++ MISRA Structural Signatures & Liability Floor
Epic: #75
Target: gitgalaxy/standards/language_standards.py & gitgalaxy/analyzers/signal_processor.py
Context & Strategic Value
While Ada paved the way, modern avionics—including the Joint Strike Fighter (JSF) and commercial flight management systems—run heavily on C and C++. To achieve DO-178C certification, these languages must be severely restricted using standards like MISRA C/C++ or JSF++ to prevent undefined behavior.
GitGalaxy must natively identify non-conformant MISRA signatures (like dynamic memory allocation or unstructured jumps) and mathematically bind them to a strict liability floor to track architectural safety.
Implementation Tasks
-
Locate the
candcppdictionaries insideLANGUAGE_DEFINITIONS. -
Implement the
misra_non_conformancerule to isolate banned functions:re.compile(r"\b(strcpy|strcat|sprintf|gets|malloc|calloc|realloc|free|longjmp|setjmp|goto)\b|\b(int|long|short|char|unsigned\s+int)\b\s+[a-zA-Z_]"). -
Add
misra_non_conformancetoRECORDING_SCHEMAS["SIGNAL_SCHEMA"]inanalysis_lens.py. -
Add
misra_exposuretoRECORDING_SCHEMAS["RISK_SCHEMA"]. -
In
signal_processor.py, implement_calc_misra_exposure(self, loc, raw_signals, lang_id, mp). -
[CRITICAL] Inject the 33.3% mathematical liability floor:
final_score = max(score, 33.3). -
Wire the new calculation directly into the central
exposure_vectordictionary. -
[Process check] Cross-reference the language's official spec/reference manual for this signature's full keyword vocabulary before closing -- do not rely solely on the abbreviated list above. Run the
tests/extraction/languages/test_<lang>_strict.pyharness and confirm coverage againstgitgalaxy/standards/how_to_add_a_language.md's recurring-bug-class checklist. (Implement Ada & SPARK Structural Signatures #76's SPARK refinement-aspect gap -- found only in a manual post-merge pass, fixed in f1326f6 -- is the failure mode this guards against.)
Validation
Run a scan against the NASA Core Flight System (nasa/cFS). The engine should successfully map the C files and generate a perfectly flat 33.3% misra_exposure floor, validating a true memory-safe architecture.
Activity