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

Crash: Range invalid bounds in XMLStackParser.swift #83

Closed
JoeMatt opened this issue Mar 8, 2019 · 1 comment
Closed

Crash: Range invalid bounds in XMLStackParser.swift #83

JoeMatt opened this issue Mar 8, 2019 · 1 comment

Comments

@JoeMatt
Copy link
Contributor

JoeMatt commented Mar 8, 2019

Line 59,

If xmlParser.lineNumber is 0 this will throw

 for i in 0..<xmlParser.lineNumber - 1 {
            errorPosition += lines[i].count
        }

Fix locally with

        let rangeMax = max(xmlParser.lineNumber - 1, 0)
        for i in 0..<rangeMax {

Not sure if this logic if correct though, instead of throwing or skipping the for loop.

@MaxDesiatov
Copy link
Collaborator

Thank you for reporting this @JoeMatt. This is fixed in #84.

MaxDesiatov added a commit that referenced this issue Mar 9, 2019
Fixes #83 

* Improve tests and fix error context handling
* Rename test to testErrorContextFirstLine
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

2 participants