fix arithmetic side-effects
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
52a561ff9e
commit
7397064edd
25 changed files with 139 additions and 114 deletions
|
@ -76,10 +76,12 @@ impl Data {
|
|||
.iter_from(&first_possible_edu, false)
|
||||
.take_while(move |(k, _)| k.starts_with(&prefix2))
|
||||
.map(move |(k, v)| {
|
||||
let count = utils::u64_from_bytes(&k[prefix.len()..prefix.len() + size_of::<u64>()])
|
||||
let count_offset = prefix.len().saturating_add(size_of::<u64>());
|
||||
let count = utils::u64_from_bytes(&k[prefix.len()..count_offset])
|
||||
.map_err(|_| Error::bad_database("Invalid readreceiptid count in db."))?;
|
||||
let user_id_offset = count_offset.saturating_add(1);
|
||||
let user_id = UserId::parse(
|
||||
utils::string_from_bytes(&k[prefix.len() + size_of::<u64>() + 1..])
|
||||
utils::string_from_bytes(&k[user_id_offset..])
|
||||
.map_err(|_| Error::bad_database("Invalid readreceiptid userid bytes in db."))?,
|
||||
)
|
||||
.map_err(|_| Error::bad_database("Invalid readreceiptid userid in db."))?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue