Fixed Rust code to avoid arithmetic overflow when a segment's bit length is very near usize::MAX.

pull/106/head
Project Nayuki 4 years ago
parent 705ce44efd
commit 43020cbd67

@ -1147,7 +1147,8 @@ impl QrSegment {
return None; // The segment's length doesn't fit the field's bit width
}
}
result = result.checked_add(4 + usize::from(ccbits) + seg.data.len())?;
result = result.checked_add(4 + usize::from(ccbits))?;
result = result.checked_add(seg.data.len())?;
}
Some(result)
}

Loading…
Cancel
Save