Skip to content

Commit 03deb09

Browse files
committed
Check offsetEnd >= offsetStart >=0 before doing String.sub text offsetStart (offsetEnd - offsetStart)
1 parent 028711a commit 03deb09

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

analysis/src/CompletionFrontEnd.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,8 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
869869
match
870870
(Pos.positionToOffset text posStart, Pos.positionToOffset text posEnd)
871871
with
872-
| Some offsetStart, Some offsetEnd ->
872+
| Some offsetStart, Some offsetEnd
873+
when offsetStart >= 0 && offsetEnd >= offsetStart ->
873874
(* Can't trust the parser's location
874875
E.g. @foo. let x... gives as label @foo.let *)
875876
let label =

0 commit comments

Comments
 (0)