hn.today

What a Rewrite of Libexpat Needs

blog.hartwork.org12 points0 comments
Screenshot of What a Rewrite of Libexpat Needs

Libexpat, also called Expat, is a fast, cross-platform C99 streaming XML parser widely used alongside libxml2. Several projects are attempting to replace it with implementations in safer languages, including Rust and Lean. Its maintainer sees a replacement as a plausible future outcome, perhaps within a few years, but argues that changing languages alone is not enough: a viable successor must preserve Expat’s practical usefulness, security, and compatibility while remaining actively maintained.

The proposed standard is demanding. A replacement should provide a drop-in C header and shared library with the full public API, handle out-of-memory conditions gracefully, and defend against billion-laughs attacks and quadratic parsing costs without blocking legitimate, complex formats such as DocBook and DITA. External entities should be supported but off by default; the implementation should address security beyond memory safety, support XML 1.0 fifth edition plus DTDs and entity types, and pass both specification-based tests and Expat’s existing suite. It should also outperform C Expat compiled with Fil-C, keep pace with upstream bug fixes and features, share discovered bugs with the maintainers, and have a liberal license such as MIT. These requirements frame a rewrite as a long-term compatibility and stewardship commitment, not merely a safer reimplementation.

Read on blog.hartwork.org0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.