From a2008118a0f22502d2f376ac31a97c4d70f960bc Mon Sep 17 00:00:00 2001 From: Devon Gardner Date: Sun, 6 Oct 2024 03:21:26 +0000 Subject: fix(coverity/510436): shada_read_when_writing index out of bounds (#30686) Problem: Index for global and numbered marks out of bounds when indexing into numbered marks array (contains 10 elements but indexed by values 26 through 35. Solution: Offset index by number of global marks to correctly index numbered marks array. --- src/nvim/shada.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 1ea9f214fb..27671771ec 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -1889,7 +1889,7 @@ static inline ShaDaWriteResult shada_read_when_writing(FileDescriptor *const sd_ // Global or numbered mark. PossiblyFreedShadaEntry *mark - = idx < 26 ? &wms->global_marks[idx] : &wms->numbered_marks[idx]; + = idx < 26 ? &wms->global_marks[idx] : &wms->numbered_marks[idx - 26]; if (mark->data.type == kSDItemMissing) { if (namedfm[idx].fmark.timestamp >= entry.timestamp) { -- cgit