Skip to content

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

Open

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.

  • [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.py harness and confirm coverage against gitgalaxy/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

  1. modified the milestones: , v2.6.0 - The Aerospace Expansion on Jul 5, 2026
  2. added
    aerospace
    core-engine
    enhancement
    on Jul 11, 2026
  3. added
    scope:frontier
    on Oct 16, 2026
  4. added
    priority: low
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    aerospacecore-engineenhancementpriority: lowscope:frontier

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions