commit a2008118a0f22502d2f376ac31a97c4d70f960bc
parent dabd7ef906a2c142dd49afd30fa258ef33cbf57a
Author: Devon Gardner <devon@goosur.com>
Date: Sun, 6 Oct 2024 03:21:26 +0000
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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) {