forked from M-Labs/artiq
1
0
Fork 0

firmware: Fix kernel RPC tuple size calculation (memory corruption)

Test case to follow.
This commit is contained in:
David Nadlinger 2019-03-30 21:30:38 +00:00 committed by Sebastien Bourdeauducq
parent b89a67ef9d
commit cb326aca70
1 changed files with 2 additions and 1 deletions

View File

@ -260,8 +260,9 @@ mod tag {
Tag::ByteArray => 8, Tag::ByteArray => 8,
Tag::Tuple(it, arity) => { Tag::Tuple(it, arity) => {
let mut size = 0; let mut size = 0;
let mut it = it.clone();
for _ in 0..arity { for _ in 0..arity {
let tag = it.clone().next().expect("truncated tag"); let tag = it.next().expect("truncated tag");
size += tag.size(); size += tag.size();
} }
size size