Skip to content

Commit decca25

Browse files
committed
Rebrand to 'Null-Safe C' and restructure memory safety section
Changes: - Rename project from "C with Strict Nullability" to "Null-Safe C" - Restructure comparison table to show Standard C baseline - Split CVE examples into two clear sections: what we fix vs don't fix - Add more real CVE examples with links (busybox, libgcrypt) - Improve accuracy: "one in four memory safety bugs" vs overstating impact - Remove "Future Work" section to focus on current capabilities
1 parent c829d6e commit decca25

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

README.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# C with Strict Nullability: An experimental fork of the Clang compiler
1+
# Null-Safe C: An experimental C compiler
22

33
An experimental Clang fork that adds **flow-sensitive null safety** to C, inspired by modern languages like TypeScript, Kotlin, and Rust.
44

@@ -10,33 +10,40 @@ Modern languages prevent null pointer crashes through **nullable types** and **t
1010

1111
## Memory Safety: The Bigger Picture
1212

13-
Null pointer dereferences are just one category of memory safety bugs. Here's where this project fits in the landscape:
13+
Null pointer dereferences are just one category of memory safety bugs. Here's how different approaches compare:
1414

15-
| Safety Category | Example Vulnerability | This Project | Rust | Bounds Safety¹ |
16-
|----------------|----------------------|--------------|------|----------------|
17-
| **Null pointer dereferences** | CVE-2019-11932 (WhatsApp) |**Fixed** | ✅ Fixed | ❌ Not addressed |
18-
| **Buffer overflows** | CVE-2014-0160 (Heartbleed) | ❌ Not addressed | ✅ Fixed | ✅ Fixed |
19-
| **Use-after-free** | CVE-2021-30551 (Chrome) | ❌ Not addressed | ✅ Fixed | ❌ Not addressed |
20-
| **Double-free** | CVE-2019-5786 (Chrome) | ❌ Not addressed | ✅ Fixed | ❌ Not addressed |
21-
| **Uninitialized memory** | CVE-2018-4259 (WebKit) | ❌ Not addressed | ✅ Fixed | ⚠️ Partial |
22-
| **Type confusion** | CVE-2015-0311 (Flash) | ❌ Not addressed | ✅ Fixed | ❌ Not addressed |
15+
### What Gets Fixed
2316

24-
<sup>1. Clang's `-fbounds-safety` experimental feature</sup>
17+
| Safety Issue | Null-Safe C | Standard C | Rust | Clang `-fbounds-safety` |
18+
|-------------|-------------|------------|------|-------------------------|
19+
| **Null pointer dereferences** | ✅ Fixed | ❌ Unsafe | ✅ Fixed | ❌ Unsafe |
20+
| **Buffer overflows** | ❌ Unsafe | ❌ Unsafe | ✅ Fixed | ✅ Fixed |
21+
| **Use-after-free** | ❌ Unsafe | ❌ Unsafe | ✅ Fixed | ❌ Unsafe |
22+
| **Double-free** | ❌ Unsafe | ❌ Unsafe | ✅ Fixed | ❌ Unsafe |
23+
| **Uninitialized memory** | ❌ Unsafe | ❌ Unsafe | ✅ Fixed | ⚠️ Partial |
2524

26-
### Why This Still Matters
25+
### Real-World Impact: CVEs This Would Prevent
26+
27+
**Null pointer dereferences** (what Null-Safe C fixes):
28+
- [CVE-2019-11932](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11932) - WhatsApp: NULL pointer dereference in MP4 parsing
29+
- [CVE-2021-3520](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3520) - lz4: NULL pointer dereference in LZ4_decompress_safe_continue
30+
- [CVE-2020-14409](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-14409) - SDL2: NULL pointer dereference in audio driver
31+
- [CVE-2022-48174](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-48174) - busybox: NULL pointer dereference in awk
32+
- [CVE-2021-33560](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-33560) - libgcrypt: NULL pointer dereference in signature verification
2733

28-
While this project doesn't solve all memory safety issues, **null pointer dereferences are extremely common**:
34+
**Other memory safety issues** (what Null-Safe C does NOT fix):
35+
- [CVE-2014-0160](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0160) - OpenSSL Heartbleed: Buffer over-read
36+
- [CVE-2021-30551](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-30551) - Chrome V8: Use-after-free
37+
- [CVE-2019-5786](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-5786) - Chrome: Use-after-free in file reader
2938

30-
- **~25% of all CVEs** involve null pointer dereferences ([Microsoft Security Response Center](https://github.com/microsoft/MSRC-Security-Research/blob/master/papers/2019/The%20Memory%20Safety%20Story.pdf))
31-
- Easier to adopt than a full language rewrite (remains 100% compatible with C)
32-
- Can be enabled incrementally (warnings by default, not errors)
33-
- Complements other safety efforts (can combine with `-fbounds-safety`)
39+
### Why This Still Matters
3440

35-
**Real-world CVEs this would catch:**
36-
- CVE-2019-11932 (WhatsApp): Null pointer dereference in MP4 parsing
37-
- CVE-2021-3520 (lz4): NULL pointer dereference in LZ4_decompress_safe_continue
38-
- CVE-2020-14409 (SDL2): NULL pointer dereference in audio driver
39-
- *[TODO: Add more specific examples with links]*
41+
While Null-Safe C doesn't solve all memory safety issues, null pointer dereferences are a significant problem:
42+
43+
- **One in four memory safety bugs** involve null pointer dereferences ([Microsoft Security Response Center](https://github.com/microsoft/MSRC-Security-Research/blob/master/papers/2019/The%20Memory%20Safety%20Story.pdf))
44+
- **Easier to adopt** than rewriting in Rust (100% compatible with existing C code)
45+
- **Incremental deployment** (warnings by default, can enable per-file)
46+
- **Complements other efforts** (combine with `-fbounds-safety` for buffer safety)
4047

4148
---
4249

@@ -104,10 +111,6 @@ void legacy_function(int* p) { ... }
104111
- **IDE integration**: Enhanced `clangd` with real-time nullability diagnostics
105112
- **Real-world tested**: Validated on cJSON, SQLite
106113
107-
### Future Work
108-
- Direct assignment narrowing (`q = p` should narrow `q` if `p` is narrowed)
109-
- Bounds safety integration (combine with `-fbounds-safety`)
110-
111114
## How It Works
112115
113116
Strict nullability adds **flow-sensitive analysis** to Clang's semantic analyzer. When you write `if (p)`, the compiler tracks that `p` is non-null within that branch—just like TypeScript, Swift, or Kotlin do. The difference is we add this to C without changing the language itself.

0 commit comments

Comments
 (0)