-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix crashes with entity references and predefined entities #13004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible to me
Reopening. This doesn't work on libxml2 < 2.12.0 because the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me
case XML_ENTITY_REF_NODE: | ||
/* Entity reference nodes are special: their children point to entity declarations, | ||
* but they don't own the declarations and therefore shouldn't free the children. | ||
* Moreover, there can be N>1 reference nodes for a single entity declarations. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The N>1
could potentially cause confusing here? Not sure what better wording is possible tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix:
* Moreover, there can be N>1 reference nodes for a single entity declarations. */ | |
* Moreover, there can be more than one reference node for a single entity declarations. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggestion looks good, thank you!
#if LIBXML_VERSION >= 21200 | ||
xmlFreeEntity(entity); | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it is unlikely that the extension is compiled against the newer version and an older libxml version is used at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be not done, that's generally always a bad idea for libraries.
There's two issues here:
The fix for the last issue is fairly easy to do on 8.3, but may require a slightly different approach on 8.2. Therefore, for now this is 8.3-only.