Skip to content

Commit 8de62e2

Browse files
committed
Check for reversed {_,_}-range
1 parent e71595e commit 8de62e2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

common/regexp.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ let parse_exn ?(pos = Lexing.dummy_pos) s =
172172
(match get j with
173173
| ',' ->
174174
let j, n_max = scan_int_opt (j + 1) in
175+
(match n_max with
176+
| Some n_max when n_max < n_min -> fail (i, j) "Reversed repeat range."
177+
| _ -> ());
175178
(j, n_min, n_max)
176179
| _ ->
177180
(j, n_min, (Some n_min)))

0 commit comments

Comments
 (0)