forked from quickshell/quickshell
		
	core/log: fix log corruption with messages at 29 second deltas
29, or 0x1d is used as a marker to mean the log level and time delta cannot fit in a single byte, and the time delta will be a varint following the current byte. Prior to this commit, 29 second deltas would be written as 0x1d instead of 0x1d1d, which the parser interpreted as a hint to read the next byte, causing the parser to become offset by one byte and all following logs to be potentially corrupt.
This commit is contained in:
		
							parent
							
								
									53b8f1ee0b
								
							
						
					
					
						commit
						5f4d7f89db
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -469,7 +469,7 @@ bool EncodedLogWriter::write(const LogMessage& message) {
 | 
			
		|||
			quint8 field = compressedTypeOf(message.type);
 | 
			
		||||
 | 
			
		||||
			auto secondDelta = this->lastMessageTime.secsTo(message.time);
 | 
			
		||||
			if (secondDelta > 29) {
 | 
			
		||||
			if (secondDelta >= 29) {
 | 
			
		||||
				// 0x1d = followed by delta int
 | 
			
		||||
				// 0x1e = followed by epoch delta int
 | 
			
		||||
				field |= (secondDelta < 0xffff ? 0x1d : 0x1e) << 3;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue