Skip to main content

Expat 2.11.0 released, fixes three vulnerabilities and adds support for XML 1.0r5

For readers new to Expat:

libexpat is a fast streaming XML parser. Alongside libxml2, Expat is one of the most widely used software libre XML parsers written in C, specifically C99. It is cross-platform and licensed under the MIT license.

Hi!

Three weeks have passed since the last release, and a lot has happened in Git master — so time for a new release and an all-human blog post about it!

Expat 2.11.0 was released a few minutes ago. The release comes with security fixes, non-security bug fixes, as well as new features.

For the security issues, we have:

  • CVE-2026-124317 — an overread in the unknown encoding decoder
  • CVE-2026-128241 — a symlink attack vulnerability in the xmlwf command-line tool of libexpat
  • CVE-2026-134703 — a security issue with the UTF-16 endianness converter

Two of these seem worthy of explanation.

Let's start with CVE-2026-128241, the xmlwf issue. When xmlwf is used with the -d <directory> mode, it creates a file in the target directory based on the input filename (or "STDIN" if the input came from standard input). When trying to create that file, in case of an existing symlink right at the expected target filename, the function fopen would follow the symlink and truncate the target file. The function fopen does not allow adjusting that behavior, so the fix was to migrate off of fopen and to a two-piece combo of open with flag O_NOFOLLOW followed by a call to fdopen to again yield a FILE * just like with fopen before. The issue was reported by Aziz Elbelaychy of Ostorlab — thank you! — and I worked on the fix.

The other issue named CVE-2026-134703 is about UTF-16 decoding and so-called surrogates that are used to encode characters beyond U+FFFF as a four-byte sequence rather than a two-byte sequence. When Expat has been compiled with XML_UNICODE (e.g. on Windows), its character type XML_Char is either based on unsigned short or the two-byte version of wchar_t (e.g. on Windows or with -fshort-wchar). Now when Expat parses UTF-16 input of the opposite byte order than that of the host (think endianness) — e.g. parsing UTF-16-BE (big-endian) on a little-endian x86_64 machine — the converter function operates on a up-to-1024-units window at a time, and there is a chance that the very last unit is a high surrogate that must be followed by a low surrogate directly, so we cannot send full 1024 units from that buffer to the application but need to cut off that trailing lone high surrogate first. The code already had a check for precisely that condition, but it did not check the right unit in all cases: it was flawed. Along with the fix, the test suite now covers that functionality in more detail. The codebase already has >95% code coverage, by the way. Thanks to Cameron Sparks for the report, the idea for the fix, and the idea for the system test!

What about the new features?

First of all, Expat now supports the name character set of not just XML 1.0r4 (fourth edition) but XML 1.0r5 (fifth edition). Here's an example of places where name-start characters. s would be a name-start character, and n would be a name character:

<!DOCTYPE sn [
  <!ELEMENT sn (#PCDATA|sn)*>
]>
<?sn?>
<sn sn=''/>

With this change there are now 936,990 characters more (from 34,516 to 971,506) that can start a name and 936,511 characers more (from 35,122 to 971,633) that can appear in a name after the start, adding support for more post-2.0 Unicode characters including Syriac, Thaana, Sinhala, Myanmar, Ethiopic, Cherokee, Unified Canadian Aboriginal Syllabics, Khmer, Mongolian, Yi script and more, and making Expat more international and inclusive. The new dedicated test suite covers every single one of the 1,114,112 codepoints regarding both name-start and name characters to be sure that the implementation is correct. As a side effect of that testing, it became clear that there were three characters that Expat had long misunderstood as name-start characters:

That is now fixed.

But there is more.

A quick interruption: If you like this article so far or are happy about this new release, please like the 2.11.0 release on GitHub. It shows me that articles like this one are read and have value, and getting a little positive feedback about a release brightens my day. Thank you!

Back to the article. There is more!

The parse API has gained three new size_t-based functions:

Also, internal size limits have been lifted so that you can now parse more than INT_MAX bytes in one go and also keep more than INT_MAX bytes in the parse buffer (even with the existing int-based parsing functions) if you like.

Furthermore, both XML_Parse and XML_Parse64 now get away with not allocating an internal buffer with the first parse call per parser instance, which reduces the memory footprint. This was working with XML_CONTEXT_BYTES == 0 already before but has been adapted to work for the default XML_CONTEXT_BYTES > 0 as well.

As usual, there are multiple non-security, non-feature improvements included with this release. For more details about this release, please check out the change log.

It should be noted that it was the Open Source Sabbatical of the City of Munich that allowed me to focus on libexpat for this release through its funding — thank you! We're in the fourth month of hopefully six months total; there continues to be plenty to do. Wish me luck!

If your business relies on Expat beyond January 2027 or did for years, please consider funding the maintenance of Expat to ensure its health and security for you and others for the future. Thank you!

Thanks to everyone who contributed to this release of Expat!

If you maintain Expat packaging, a bundled copy of Expat, or a pinned version of Expat, please update to version 2.11.0. Thank you!

Sebastian Pipping