Security context

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

earwig/mwparserfromhell
main @ c501415
9
Fixes
0
CVEs
HIGH
Peak severity
12.5%
Coverage
Highlights
Denial of Service: 6 prior fixes. Scrutinize any change in this area.
mwparserfromhell/parser/ctokenizer/tok_parse.c: most-fixed (4 issues). Treat as high-risk during review.
3 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.

Denial of Service: Deeply nested tags, self-closing tags within attributes of unpaired tags, and unclosed quoted attributes can trigger infinite loops or catastrophic backtracking. Secure parsing requires explicit recursion limits, memoization of failed/bad routes, and strict loop termination guards.
Memory Corruption: Using standard libc memory functions (like calloc) and passing the resulting pointers to Python's memory manager (PyObject_Free), or vice versa, leads to allocator mismatch and memory corruption. Redirection macros must consistently force Python's API wrappers.
Memory Corruption: Double-free (double-decref) bugs occur when developers release PyObject references manually after APIs like PyList_SetItem fail, which internally steal reference ownership regardless of the execution success.