Security context

What an agent needs to avoid regressing past fixes and find the next vuln in this repo.

ijl/orjson
master @ 705515d
4
Fixes
2
CVEs
HIGH
Peak severity
50.0%
Coverage
Highlights
Memory Corruption: 3 prior fixes. Scrutinize any change in this area.
src/deserialize/cache.rs: most-fixed (1 issue). Treat as high-risk during review.
4 high-severity fixes in this history; regressions here are high-impact.
Recurring patterns

The bug types that recur here, drawn from past fixes, not open vulnerabilities.

Memory Corruption: Using hardcoded CPython internal struct layouts (e.g., PyCompactUnicodeObject, PyDictObject) instead of proper FFI bindings leads to memory corruption when Python internals shift. Developers must rely on verified pyo3::ffi structures instead of raw casting.
Memory Corruption: Re-entrant execution of parsing functions can cause memory corruption if thread-local or static buffer pools (like the yyjson allocator pool) are re-initialized mid-flight. Ensure initialization occurs exactly once and is safe against re-entrancy.
Race Condition: Concurrently initializing global caches using unsafe static mut access results in data races. Safe initialization must be enforced using thread-safe synchronization primitives like OnceCell or OnceLock.