Skip to content

serde_hjson::from_slice panics on decoding invalid utf8 #19

Closed

Description

@alexanderkjall

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);
    }
}

Activity

  1. added a commit that references this issue on Jul 23, 2024
    a98f1ec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions