Skip to content

Commit

Permalink
catch serialization buffer edge case
Browse files Browse the repository at this point in the history
if the buffer fills up to the point where there isn't enough
space for the 8-bytes of header, a split_at() call will fail before
the routine even gets to decide if the record can fit.

abort the loop if the buffer is that full.
  • Loading branch information
bunnie committed Oct 27, 2022
1 parent c82a79d commit d63c452
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions services/pddb/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,10 @@ fn wrapped_main() -> ! {
Failure(String)
}
loop {
if buf.len() < size_of::<u32>() * 2 {
// not enough space to hold our header records, break and get a new buf
break;
}
#[cfg(feature="perfcounter")]
pddb_os.perf_entry(FILE_ID_SERVICES_PDDB_SRC_MAIN, perflib::PERFMETA_STARTBLOCK, 6, std::line!());
let ser_result: SerializeResult =
Expand Down

0 comments on commit d63c452

Please sign in to comment.