From: Ben Pfaff Date: Tue, 14 Oct 2025 23:36:11 +0000 (-0700) Subject: fix X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09a6c41b27a139a2f67035ee9c4e99aa2dc4697f;p=pspp fix --- diff --git a/rust/doc/src/spv/light-detail.md b/rust/doc/src/spv/light-detail.md index f89eb5d659..b42b6ebbe6 100644 --- a/rust/doc/src/spv/light-detail.md +++ b/rust/doc/src/spv/light-detail.md @@ -661,7 +661,7 @@ X3 => double[small] 01 (string[dataset] string[datafile] i0 int32[date] i0)? Y2 - (int32[x22] i0 01?)? + (int32[x22] i0 bool[x25]?)? ``` `small` is a small real number. In the corpus, it overwhelmingly @@ -686,8 +686,10 @@ a null byte (a valid string never will). `x22` is usually 0 or 2000000. -A writer may safely use 4 for `x21` and omit `x22` and the other -optional bytes at the end. +`x25` is usually `01`. + +A writer may safely use 4 for `x21` and omit `x22`, `x25`, and the +other optional bytes at the end. ### Encoding diff --git a/rust/pspp/src/output/spv/light.rs b/rust/pspp/src/output/spv/light.rs index 22a01e8386..fdc2864aa5 100644 --- a/rust/pspp/src/output/spv/light.rs +++ b/rust/pspp/src/output/spv/light.rs @@ -712,13 +712,13 @@ where endian: binrw::Endian, args: Self::Args<'_>, ) -> BinResult { - let start = reader.stream_position()?; let count = u32::read_options(reader, endian, ())? as u64; + let start = reader.stream_position()?; let end = start + count; let mut inner = reader.take_seek(count); let result = ::read_options(&mut inner, Endian::Little, args)?; let pos = inner.stream_position()?; - if pos < end { + if pos != end { let consumed = pos - start; return Err(binrw::Error::Custom { pos, @@ -1001,8 +1001,8 @@ struct X3Tail { _x22: i32, #[br(temp, assert(_zero == 0))] _zero: i32, - #[br(temp)] - _one: Optional, + #[br(temp, assert(_x25.is_none_or(|x25| x25 == 0 || x25 == 1)))] + _x25: Optional, } #[binread]