Skip to content

Commit

Permalink
fix: 'GetLineByteFromPos' maybe return val overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane-XB-Qian committed Aug 31, 2024
1 parent 89d5350 commit 1138e88
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions autoload/lsp/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ export def GetLineByteFromPos(bnr: number, pos: dict<number>): number
return byteIdx
endif

# If byteIdx is -1
# If col was an invalid val
var byteLenMax = ltext->len()
if col > byteLenMax
return byteLenMax
endif

return col
enddef

Expand Down

0 comments on commit 1138e88

Please sign in to comment.