Skip to content

Potential Bug #367

@YichiZhang0613

Description

@YichiZhang0613

In msgpack-rust-master/rmp/src/encode/mod.rs, the comment indicates that function will panic if ty is negative.

/// # Panics
///
/// Panics if `ty` is negative, because it is reserved for future MessagePack extension including
/// 2-byte type information.
pub fn write_ext_meta<W: RmpWrite>(wr: &mut W, len: u32, ty: i8) -> Result<Marker, ValueWriteError<W::Error>> {

However, following test will not panic, which is inconsistent with comment.

#[test]
fn test(){
    let mut buf = [0x00, 0x00];
    assert_eq!(Marker::FixExt1, write_ext_meta(&mut &mut buf[..], 1, -1).unwrap());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions