Skip to content

Implement C/C++ MISRA Structural Signatures & Liability Floor #80

Description

@squid-protocol

[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 c and cpp dictionaries inside LANGUAGE_DEFINITIONS.
  • Implement the misra_non_conformance rule 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_conformance to RECORDING_SCHEMAS["SIGNAL_SCHEMA"] in analysis_lens.py.
  • Add misra_exposure to RECORDING_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_vector dictionary.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions