Skip to content

Commit

Permalink
python: Use a safer regex for range checks
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix committed Jan 13, 2024
1 parent 86d3df3 commit 2c082e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/grass/pygrass/modules/interface/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def __init__(self, xparameter=None, diz=None):
try:
# Check for integer ranges: "3-30" or float ranges: "0.0-1.0"
isrange = re.match(
r"(?P<min>-*\d+.*\d*)*-(?P<max>\d+.*\d*)*", diz["values"][0]
r"(?P<min>-?(?:\d*\.)?\d+)?-(?P<max>-?(?:\d*\.)?\d+)?",
diz["values"][0],
)
if isrange:
mn, mx = isrange.groups()
Expand Down

0 comments on commit 2c082e9

Please sign in to comment.