Skip to content
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

Escaped HEX codes break the parser #60

Open
brainlid opened this issue Apr 9, 2018 · 0 comments
Open

Escaped HEX codes break the parser #60

brainlid opened this issue Apr 9, 2018 · 0 comments

Comments

@brainlid
Copy link

brainlid commented Apr 9, 2018

Elixir 1.5.2
sweet_xml 0.6.5

The following XML file will break the parser

SweetXml.parse("<test>Some Text&#x1A;</test>")

The error is:

** (exit) {:fatal, {{:error, {:wfc_Legal_Character, 26}}, {:file, :file_name_unknown}, {:line, 1}, {:col, 22}}}
    (xmerl) xmerl_scan.erl:4117: :xmerl_scan.fatal/2
    (xmerl) xmerl_scan.erl:2908: :xmerl_scan.scan_char_ref_hex/3
    (xmerl) xmerl_scan.erl:2572: :xmerl_scan.scan_content/11
    (xmerl) xmerl_scan.erl:2133: :xmerl_scan.scan_element/12
    (xmerl) xmerl_scan.erl:575: :xmerl_scan.scan_document/2
    (xmerl) xmerl_scan.erl:291: :xmerl_scan.string/2
    (sweet_xml) lib/sweet_xml.ex:233: SweetXml.parse/2
[error] 3429- fatal: {:error, {:wfc_Legal_Character, 26}}

It is incorrectly unescaping the escaped HEX value for ASCII 26, which is an invalid XML character.

I have worked around the issue for my own needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant