Skip to content

Fix: XML::TextReader must keep IO object reference [fixup #15906]#15933

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:fix/xml-text-reader-can-lose-io-reference
Jun 30, 2025
Merged

Fix: XML::TextReader must keep IO object reference [fixup #15906]#15933
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:fix/xml-text-reader-can-lose-io-reference

Conversation

@ysbaddaden
Copy link
Collaborator

Running the std xml specs could sometimes lead to a segfault. The problem is that the IO object passed to XML::TextReader can be collected by the GC before the XML::TextReader is finalized, leading to a segfault when libxml trying to close the input buffer, hence close the IO object, and 💥

Also harmonizes the callbacks to use ->method with the rest of the libxml library.

fixup #15899
fixup #15906

@ysbaddaden ysbaddaden self-assigned this Jun 27, 2025
@ysbaddaden ysbaddaden added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:serialization labels Jun 27, 2025
@straight-shoota straight-shoota added this to the 1.17.0 milestone Jun 27, 2025
@straight-shoota straight-shoota merged commit a356267 into crystal-lang:master Jun 30, 2025
44 checks passed
@ysbaddaden ysbaddaden deleted the fix/xml-text-reader-can-lose-io-reference branch June 30, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:serialization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants