From 75931f1a00cfdcaf8cc0e262e6dff5031caa3a03 Mon Sep 17 00:00:00 2001 From: youhwsh Date: Sun, 6 Sep 2026 23:17:08 +0800 Subject: [PATCH] fix UB when opening an empty sparse layer Signed-off-by: youhwsh --- src/overlaybd/lsmt/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlaybd/lsmt/file.cpp b/src/overlaybd/lsmt/file.cpp index 0669478c..19937bd8 100644 --- a/src/overlaybd/lsmt/file.cpp +++ b/src/overlaybd/lsmt/file.cpp @@ -1504,7 +1504,7 @@ IFileRW *open_file_rw(IFile *fdata, IFile *findex, bool ownership) { if (LSMTSparseFile::create_mappings(fdata, mappings) == -1) { LOG_ERROR_RETURN(0, nullptr, "failed to create segment mappings from sparse file!"); } - pi = create_memory_index0((const SegmentMapping *)&mappings[0], mappings.size(), + pi = create_memory_index0(mappings.data(), mappings.size(), HeaderTrailer::SPACE / ALIGNMENT, stat.st_size / ALIGNMENT); if (!pi) { LOG_ERROR_RETURN(0, nullptr, "failed to create memory index from sparse file!");