Bug 288153

Summary: [XML Parser] Don't overwrite result of xmlGetPredefinedEntity
Product: WebKit Reporter: zak ridouh <zakr>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ddkilzer, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

zak ridouh
Reported 2025-02-20 15:05:36 PST
Currently, in `xmlGetPredefinedEntity` (Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:1262), we overwrite the value of `ent->etype`, which for xmlGetPredefinedEntity, should always be of type `XML_INTERNAL_PREDEFINED_ENTITY` See: <https://gitlab.gnome.org/GNOME/libxml2/-/blob/master/entities.c#L311> & <https://gitlab.gnome.org/GNOME/libxml2/-/blob/master/entities.c#L36> We should just use a debug ASSERT to verify that the result has the expected type, and not overwrite it. Functionally, this should have 0 changes in behavior of our XML Parser, but allows these global types to be set to const in the libxml2 codebase. The upstream maintainer of libxml2 attempted to make these globals `const` in a previous patch <https://gitlab.gnome.org/GNOME/libxml2/-/commit/63ce5f9aedccda737f5b25a28dba1fdeecbdbfc6> which he then reverted <https://gitlab.gnome.org/GNOME/libxml2/-/commit/f0d891585d63e380bf45044d4b5e535dc610871a> due to us and Chromium setting the value unnecessarily. This does not currently impact our shipping software, but proactively prepares us for future versions, and changes in upstream. Chromium also aligned their code here: <https://chromium-review.googlesource.com/c/chromium/src/+/5592393>
Attachments
Radar WebKit Bug Importer
Comment 1 2025-02-20 15:06:22 PST
zak ridouh
Comment 2 2025-02-20 15:10:10 PST
EWS
Comment 3 2025-02-20 17:39:35 PST
Committed 290765@main (f337e8735a7d): <https://commits.webkit.org/290765@main> Reviewed commits have been landed. Closing PR #41013 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.