From d63c452fb63ee018a1addf9c079fe22504210f60 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 27 Oct 2022 23:00:10 +0800 Subject: [PATCH] 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. --- services/pddb/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index f8d245acb..177693eca 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -1500,6 +1500,10 @@ fn wrapped_main() -> ! { Failure(String) } loop { + if buf.len() < size_of::() * 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 =