fix: invalid typing bytes because of 0xff in numbers
This commit is contained in:
		
							parent
							
								
									bcd1fe1856
								
							
						
					
					
						commit
						c15ae3c126
					
				
					 2 changed files with 7 additions and 3 deletions
				
			
		|  | @ -11,6 +11,7 @@ use ruma::{ | |||
| use std::{ | ||||
|     collections::HashMap, | ||||
|     convert::{TryFrom, TryInto}, | ||||
|     mem, | ||||
| }; | ||||
| 
 | ||||
| #[derive(Clone)] | ||||
|  | @ -228,9 +229,11 @@ impl RoomEdus { | |||
|                 let key = key?; | ||||
|                 Ok::<_, Error>(( | ||||
|                     key.clone(), | ||||
|                     utils::u64_from_bytes(key.split(|&b| b == 0xff).nth(1).ok_or_else(|| { | ||||
|                     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 @@ impl Sending { | |||
|                 select! { | ||||
|                     Some(server) = futures.next() => { | ||||
|                         warn!("response: {:?}", &server); | ||||
|                         warn!("futures left: {}", &futures.len()); | ||||
|                         match server { | ||||
|                             Ok((server, _response)) => { | ||||
|                                 waiting_servers.remove(&server) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue