diff options
| author | ckelsel <ckelsel@hotmail.com> | 2017-07-10 08:10:15 +0800 |
|---|---|---|
| committer | ckelsel <ckelsel@hotmail.com> | 2017-07-10 08:10:15 +0800 |
| commit | 465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77 (patch) | |
| tree | edae38568202ba41dee4a49f78884da313fd114b /src/nvim/shada.c | |
| parent | 1514cdc7d8863eeee6b04883b1c50aac40048b49 (diff) | |
| parent | 6725667d31591e8025589c4c1df34469f3bfdb52 (diff) | |
| download | rneovim-465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77.tar.gz rneovim-465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77.tar.bz2 rneovim-465bbee520d1b1b57477fd7d80fbdeaf5e1e1e77.zip | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/nvim/shada.c')
| -rw-r--r-- | src/nvim/shada.c | 12 |
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 |