mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
fix(coverity/497355): shada_read_when_writing out of bounds read #30665
Problem: There appears to be an intentional array out of bounds read when indexing global and numbered marks since they are adjacent in the struct that holds them. Solution: Explicitly index numeric marks array to avoid reading out of bounds from global marks array.
This commit is contained in:
parent
988482d942
commit
ff7832ad3f
@ -1886,13 +1886,18 @@ static inline ShaDaWriteResult shada_read_when_writing(FileDescriptor *const sd_
|
|||||||
shada_free_shada_entry(&entry);
|
shada_free_shada_entry(&entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (wms->global_marks[idx].data.type == kSDItemMissing) {
|
|
||||||
|
// Global or numbered mark.
|
||||||
|
PossiblyFreedShadaEntry *mark
|
||||||
|
= idx < 26 ? &wms->global_marks[idx] : &wms->numbered_marks[idx];
|
||||||
|
|
||||||
|
if (mark->data.type == kSDItemMissing) {
|
||||||
if (namedfm[idx].fmark.timestamp >= entry.timestamp) {
|
if (namedfm[idx].fmark.timestamp >= entry.timestamp) {
|
||||||
shada_free_shada_entry(&entry);
|
shada_free_shada_entry(&entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
COMPARE_WITH_ENTRY(&wms->global_marks[idx], entry);
|
COMPARE_WITH_ENTRY(mark, entry);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kSDItemChange:
|
case kSDItemChange:
|
||||||
|
Loading…
Reference in New Issue
Block a user