From bbf225b7883e33b79cf115e6b60540f4a77886e5 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 2 Jun 2025 10:41:09 -0400 Subject: [PATCH] add a sanity check to fuchsia importer --- import/src/import-fuchsia.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/import/src/import-fuchsia.cpp b/import/src/import-fuchsia.cpp index fb4debbf..785979c1 100644 --- a/import/src/import-fuchsia.cpp +++ b/import/src/import-fuchsia.cpp @@ -188,6 +188,12 @@ std::pair read_next_record(std::vector const &input, size CHECK_BOUND(offset + 8*len_word); Record r{(uint64_t *)&input[offset], len_word, header}; + + if (len_word == 0) { + fprintf(stderr, "warning: invalid record with length=0 at offset %" PRIu64 "\n", offset); \ + return std::make_pair(false,Record{}); \ + } + offset += 8 * len_word; return std::make_pair(true, r); }