Don't raise from parse() on entity backslashes, out-of-range character references, or non-numeric EPSG codes - #600
Closed
DrVelvetFog wants to merge 1 commit into
Closed
DrVelvetFog wants to merge 1 commit into
DrVelvetFog wants to merge 1 commit into
Conversation
…, or non-numeric EPSG codes Refs kurtmckee#599.
Owner
|
This seems to be generated by AI. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three of the cases in #599:
sanitizer.replace_doctype(): pass the rebuilt entity declarations toRE_DOCTYPE_PATTERN.sub()through a function, so backslashes in entity values aren't read as escapes or group references. Before,C:\dataraisedre.PatternError,C:\tempturned into a tab, and\1pulled in DOCTYPE text.mixin.handle_charref(): map character references above U+10FFFF, and surrogates, to U+FFFD (what HTML parsers do) instead of raising fromchr()/.encode().namespaces/georss.py: if the EPSG code insrsNameisn't an integer, treat it like a missingsrsNameinstead of raising fromint(). The check that was duplicated in_end_gml_posand_end_gml_poslistis now one helper.Tests, in the existing data-driven format:
tests/wellformed/rss/entity_in_doctype_backslash.xml:C:\data\1\newcomes through unchangedtests/illformed/charref_out_of_range.xml:�,�and�become U+FFFDtests/wellformed/geo/gml_point_epsg_not_numeric.xml:srsName="EPSG:unknown"parses like a point with nosrsNameAll three fail without the change (5 failures across the strict and loose parsers). The full suite passes: 4302 passed, 8 skipped.
blackandisortare clean. Changelog fragment added under "Fixed".