aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevon Gardner <devon@goosur.com>2024-10-06 03:21:26 +0000
committerGitHub <noreply@github.com>2024-10-06 11:21:26 +0800
commita2008118a0f22502d2f376ac31a97c4d70f960bc (patch)
tree749c6c34f4683734218c5a63aa4c5d161802e772
parentdabd7ef906a2c142dd49afd30fa258ef33cbf57a (diff)
downloadrneovim-a2008118a0f22502d2f376ac31a97c4d70f960bc.tar.gz
rneovim-a2008118a0f22502d2f376ac31a97c4d70f960bc.tar.bz2
rneovim-a2008118a0f22502d2f376ac31a97c4d70f960bc.zip
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.
-rw-r--r--src/nvim/shada.c2
1 files changed, 1 insertions, 1 deletions
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) {