Skip to content

Commit d63c452

Browse files
committed
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.
1 parent c82a79d commit d63c452

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

services/pddb/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,10 @@ fn wrapped_main() -> ! {
15001500
Failure(String)
15011501
}
15021502
loop {
1503+
if buf.len() < size_of::<u32>() * 2 {
1504+
// not enough space to hold our header records, break and get a new buf
1505+
break;
1506+
}
15031507
#[cfg(feature="perfcounter")]
15041508
pddb_os.perf_entry(FILE_ID_SERVICES_PDDB_SRC_MAIN, perflib::PERFMETA_STARTBLOCK, 6, std::line!());
15051509
let ser_result: SerializeResult =

0 commit comments

Comments
 (0)