mirror of
https://github.com/neovim/neovim
synced 2025-07-17 09:41:46 +00:00
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.
This commit is contained in:
@ -1889,7 +1889,7 @@ static inline ShaDaWriteResult shada_read_when_writing(FileDescriptor *const sd_
|
|||||||
|
|
||||||
// Global or numbered mark.
|
// Global or numbered mark.
|
||||||
PossiblyFreedShadaEntry *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 (mark->data.type == kSDItemMissing) {
|
||||||
if (namedfm[idx].fmark.timestamp >= entry.timestamp) {
|
if (namedfm[idx].fmark.timestamp >= entry.timestamp) {
|
||||||
|
Reference in New Issue
Block a user