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

Fatal error generated when insufficient data reached while parsing escaped sequence #494

Closed
nirosys opened this issue Mar 27, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@nirosys
Copy link
Contributor

nirosys commented Mar 27, 2023

When insufficient data is encountered while parsing an escaped string sequence (appears to be all types of sequences, but I have not verified), an error is returned that is not correctly identified as Insufficient data. This is causing the raw text reader to fail rather than requesting more data.

@nirosys nirosys added the bug Something isn't working label Mar 27, 2023
@nirosys nirosys self-assigned this Mar 27, 2023
@nirosys
Copy link
Contributor Author

nirosys commented Mar 28, 2023

After some digging, just re-read the error and realized this is not a UTF-8 boundary issue, but rather the parser not correctly identifying an incomplete error while parsing escaped sequences.

Trivial repro:

let source = "\"123456\\u269b\"";
//                       ^-- First read stops here.
let mut reader = RawTextReader::new(source.as_bytes()[..10].to_owned());
reader.next()?;

Running that returns an Err of:

unexpected error after partial escaped sequence: unrecognized input near line 0: could not parse an escaped character (Unicode, hex, or literal): Parsing requires more data: '"123456\u2''

@nirosys nirosys changed the title Invalid UTF-8 Sequence while parsing text Ion. Fatal error generated when insufficient data reached while parsing escaped sequence Mar 28, 2023
@nirosys
Copy link
Contributor Author

nirosys commented Jun 19, 2023

A fix for this was merged a while ago, closing.

@nirosys nirosys closed this as completed Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant