Skip to content

Commit 736c83d

Browse files
committed
fix: 'GetLineByteFromPos' maybe return val overflow
1 parent 89d5350 commit 736c83d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

autoload/lsp/util.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ export def GetLineByteFromPos(bnr: number, pos: dict<number>): number
179179
return byteIdx
180180
endif
181181

182+
# If byteIdx is -1
183+
# If col was an invalid val
184+
var byteLenMax = ltext->len()
185+
if col > byteLenMax
186+
return byteLenMax
187+
endif
188+
182189
return col
183190
enddef
184191

0 commit comments

Comments
 (0)