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

serde_hjson::from_slice panics on decoding invalid utf8 #19

Closed
alexanderkjall opened this issue Sep 24, 2020 · 0 comments
Closed

serde_hjson::from_slice panics on decoding invalid utf8 #19

alexanderkjall opened this issue Sep 24, 2020 · 0 comments

Comments

@alexanderkjall
Copy link

Hi

I found that the from_slice function panics if the input isn't a valid utf8 string instead of returning an error value.

Can be reproduced with this unit test:


#[cfg(test)]
mod test {
    use crate::{Map,Value};
    use crate::error::Result;

    #[test]
    pub fn invalid_utf8() {
        let data: Vec<u8> = vec![155];

        let mut sample: Result<Map<String, Value>> = crate::from_slice(&data);
    }
}

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