catch serialization buffer edge case

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.
This commit is contained in:
bunnie 2022-10-27 23:00:10 +08:00
parent c82a79dab9
commit d63c452fb6

View file

@ -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 =