Skip to content

Commit

Permalink
check for null fields on deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed May 31, 2024
1 parent 53d2cfd commit 7b068cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion codegen/rust/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ impl<'a> HeaderGenerator<'a> {
let n = (#end-#offset);
let m = n%8;
let mut b = BitVec::<u8, Msb0>::from_vec(v);
x[#offset..#end] |= &b[m..];
// this field may be null so check that we at least have
// enough space to offset
if b.len() > m {
x[#offset..#end] |= &b[m..];
}
} else {
x[#offset..#end] |= self.#name.to_owned();
}
Expand Down

0 comments on commit 7b068cb

Please sign in to comment.