atharvalade opened a new issue, #2979:
URL: https://github.com/apache/iggy/issues/2979

   `core/server/src/binary/mapper.rs:60-62` conditionally writes 
`iggy_server_semver` only when `Some`:
   
   ```
   if let Some(semver) = stats.iggy_server_semver {
       bytes.put_u32_le(semver);
   }
   ```
   
   When `None`, zero bytes are written. But all SDK deserializers (Rust, Java, 
and the new `binary_protocol` crate) unconditionally read 4 bytes here, using 0 
as the `None` sentinel. If the server ever sends None, every field after 
`semver` gets shifted, corrupting the entire stats response.
   
   The same issue exists in 
`core/binary_protocol/src/responses/system/get_stats.rs:151-153` (semver) and 
lines 167-171 (where `threads_count`, `free_disk_space`, `total_disk_space` are 
also conditionally skipped when `semver` is absent).
   
   This is not critical because it is currently unreachable because the server 
always derives `semver` from `CARGO_PKG_VERSION` via 
`SEMANTIC_VERSION.get_numeric_version().ok()`, which succeeds for any valid 
version. But it's a latent correctness issue.
   
   Fix: bytes.put_u32_le(stats.iggy_server_semver.unwrap_or(0)); and always 
write the tail fields unconditionally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to