aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2020-08-03 22:57:13 +0900
committerGitHub <noreply@github.com>2020-08-03 22:57:13 +0900
commitf26df8bb66158baacb79c79822babaf137607cd6 (patch)
tree484ebe23976246f6ef21fff7f7510a7a55383268 /src
parent4ed5204bc9d5811cd45209476ac1b9e2c2b74146 (diff)
parent872ecf65d10f0d22bbf3e2257f9ae89a6c61d2f4 (diff)
downloadrneovim-f26df8bb66158baacb79c79822babaf137607cd6.tar.gz
rneovim-f26df8bb66158baacb79c79822babaf137607cd6.tar.bz2
rneovim-f26df8bb66158baacb79c79822babaf137607cd6.zip
Merge pull request #12701 from erw7/fix-sattr-t-overflow
ui: fix problem with sattr_T overflow
Diffstat (limited to 'src')
-rw-r--r--src/nvim/grid_defs.h2
-rw-r--r--src/nvim/highlight.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/grid_defs.h b/src/nvim/grid_defs.h
index c6687c8da9..e14aae73d8 100644
--- a/src/nvim/grid_defs.h
+++ b/src/nvim/grid_defs.h
@@ -11,7 +11,7 @@
// The characters and attributes drawn on grids.
typedef char_u schar_T[(MAX_MCO+1) * 4 + 1];
-typedef int16_t sattr_T;
+typedef int sattr_T;
/// ScreenGrid represents a resizable rectuangular grid displayed by UI clients.
///
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index c0cae54572..262afba07a 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -90,7 +90,12 @@ static int get_attr_entry(HlEntry entry)
}
}
- id = (int)kv_size(attr_entries);
+ size_t next_id = kv_size(attr_entries);
+ if (next_id > INT_MAX) {
+ ELOG("The index on attr_entries has overflowed");
+ return 0;
+ }
+ id = (int)next_id;
kv_push(attr_entries, entry);
map_put(HlEntry, int)(attr_entry_ids, entry, id);