From dae461faa1fa2b653b990db33314cda0b41e56b0 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 23 Mar 2017 17:22:40 +0000 Subject: [PATCH] Fix panic caused by trying to deal with parsing incorrect size int. According to the spec, the bytes following `\x01\x00` should be an unsigned short int. `nom` was told to use a signed int which would panic when given the wrong size. --- src/header.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/header.rs b/src/header.rs index 2dfd1e5..7e3cbbc 100644 --- a/src/header.rs +++ b/src/header.rs @@ -60,7 +60,7 @@ mod parser { tag!(&[0x93u8]) >> tag!(b"NUMPY") >> tag!(&[0x01u8, 0x00]) >> - hdr: length_value!(le_i16, item) >> + hdr: length_value!(le_u16, item) >> (hdr) ) );