Skip to content

Memory-safety analysis for C and C++ - #188

Merged
prabhu merged 1 commit into
mainfrom
feat/memsafe-part1
Sep 28, 2026
Merged

prabhu merged 1 commit into
mainfrom
feat/memsafe-part1

Conversation

@prabhu

@prabhu prabhu commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

A memory-safety overlay for C and C++; version 4.0.0.

  • Fact passes: MemorySemanticsPass (memory API semantics from attributes, bodies and storage), MemoryApiPass (allocator, copy and free call sites and argument roles, with a configurable inventory), ExtentPass (buffer capacities), GuardPass (what a comparison establishes), ValueOriginPass (where a length or index comes from), IntegerWidthPass and AllocationStatePass.
  • MemorySafetyFindingPass reads those facts into the MS-* rules: bounds and copies, integer overflow into lengths, allocation state (leak, double free, use after free), null dereference, stack escape, uninitialised reads, format strings and container invalidation. A finding is reported only when the facts cannot prove the access safe, and it carries a confidence level.
  • c2cpg: header struct and class member layouts, header const values, macro arguments on synthetic macro calls, namespace-qualified spelling of classes named plainly, a versioned AST cache, and an opt-in macro census that finds #if code hidden by undefined build macros.
  • C flow semantics fixes for libc copy, scan and allocation functions; memoised default data-flow semantics.
  • Scala 3.9.0 LTS.

Results on the memory-safety corpus (baseline 0%): recall 62.77% / precision 98.33% at medium confidence, 75.53% / 95.95% at low, no findings on the negative controls. FFmpeg libavformat CVE litmus: 5/13 at medium and 7/13 at low (6 and 8 with the macro census applied), with no findings at the fixed sites. leveldb and abseil were analysed with the built-in API vocabulary only.

…rsion 4.0.0, and reword comments to drop internal plan references
@prabhu
prabhu merged commit f18a20f into main Sep 28, 2026
10 checks passed
@prabhu
prabhu deleted the feat/memsafe-part1 branch September 28, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant