Skip to content
Snippets Groups Projects
Unverified Commit c15ae3c1 authored by Timo Kösters's avatar Timo Kösters
Browse files

fix: invalid typing bytes because of 0xff in numbers

parent bcd1fe18
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@
use std::{
collections::HashMap,
convert::{TryFrom, TryInto},
mem,
};
#[derive(Clone)]
......@@ -228,9 +229,11 @@ fn typings_maintain(
let key = key?;
Ok::<_, Error>((
key.clone(),
utils::u64_from_bytes(key.split(|&b| b == 0xff).nth(1).ok_or_else(|| {
Error::bad_database("RoomTyping has invalid timestamp or delimiters.")
})?)
utils::u64_from_bytes(
&key.splitn(2, |&b| b == 0xff).nth(1).ok_or_else(|| {
Error::bad_database("RoomTyping has invalid timestamp or delimiters.")
})?[0..mem::size_of::<u64>()],
)
.map_err(|_| Error::bad_database("RoomTyping has invalid timestamp bytes."))?,
))
})
......
......@@ -28,6 +28,7 @@ pub fn start_handler(&self, globals: &super::globals::Globals, rooms: &super::ro
select! {
Some(server) = futures.next() => {
warn!("response: {:?}", &server);
warn!("futures left: {}", &futures.len());
match server {
Ok((server, _response)) => {
waiting_servers.remove(&server)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment