aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-07-04 21:56:05 +0200
committerGitHub <noreply@github.com>2017-07-04 21:56:05 +0200
commit1b70a1da0438018475a73e23015421b2212b34df (patch)
treebf2544be2eb77c21ecd1b3f19d3a1169ef64abfa /src
parent957a6506ef4672f2aa3df515bf9d971b7fc968f4 (diff)
parent63f72ac27c54d63fee049e45a5518d2d07fd379b (diff)
downloadrneovim-1b70a1da0438018475a73e23015421b2212b34df.tar.gz
rneovim-1b70a1da0438018475a73e23015421b2212b34df.tar.bz2
rneovim-1b70a1da0438018475a73e23015421b2212b34df.zip
Merge #6958 from ZyX-I/fix-6957
Diffstat (limited to 'src')
-rw-r--r--src/nvim/shada.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 4788b1e7d0..736d6bf162 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -3413,8 +3413,16 @@ shada_read_next_item_start:
return mru_ret;
}
- const size_t length = (size_t) length_u64;
- entry->timestamp = (Timestamp) timestamp_u64;
+ if (length_u64 > PTRDIFF_MAX) {
+ emsgf(_(RCERR "Error while reading ShaDa file: "
+ "there is an item at position %" PRIu64 " "
+ "that is stated to be too long"),
+ initial_fpos);
+ return kSDReadStatusNotShaDa;
+ }
+
+ const size_t length = (size_t)length_u64;
+ entry->timestamp = (Timestamp)timestamp_u64;
if (type_u64 == 0) {
// kSDItemUnknown cannot possibly pass that far because it is -1 and that