1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 18:24:05 +02:00

fix truncated demos during reencode

This commit is contained in:
Robin Appelman 2021-08-29 18:28:26 +02:00
commit 10429c6d29
3 changed files with 65 additions and 12 deletions

View file

@ -6,8 +6,8 @@ use crate::ReadResult;
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Debug, BitWrite, PartialEq, Serialize, Deserialize, Clone)]
pub struct ConVar {
key: String,
value: String,
pub key: String,
pub value: String,
}
impl<E: Endianness> BitRead<'_, E> for ConVar {
@ -25,9 +25,9 @@ impl<E: Endianness> BitRead<'_, E> for ConVar {
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Debug, BitRead, PartialEq, Serialize, Deserialize, Clone)]
pub struct SetConVarMessage {
length: u8,
pub length: u8,
#[size = "length"]
vars: Vec<ConVar>,
pub vars: Vec<ConVar>,
}
impl<E: Endianness> BitWrite<E> for SetConVarMessage {

View file

@ -136,7 +136,7 @@ impl<'a> RawPacketStream<'a> {
Ok(Some(packet))
}
Ok(packet) => Ok(Some(packet)),
Err(ParseError::ReadError(BitError::NotEnoughData { .. })) if false => {
Err(ParseError::ReadError(BitError::NotEnoughData { .. })) => {
self.ended = true;
self.incomplete = true;
Ok(None)