aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/fileio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 7573064fa9..1b39a7410a 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -1360,6 +1360,10 @@ retry:
u8c += (unsigned)(*--p) << 16;
u8c += (unsigned)(*--p) << 24;
}
+ // Replace characters over INT_MAX with Unicode replacement character
+ if (u8c > INT_MAX) {
+ u8c = 0xfffd;
+ }
} else { // UTF-8
if (*--p < 0x80) {
u8c = *p;