1
0
Fork 0
forked from josch/img2pdf

do not allow negative values in parse_num()

This commit is contained in:
Johannes 'josch' Schauer 2020-08-03 12:25:14 +02:00
parent a2d846052e
commit 5b7f93bb9a
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -2083,6 +2083,9 @@ def parse_num(num, name):
except ValueError:
msg = "%s is not a floating point number: %s" % (name, num)
raise argparse.ArgumentTypeError(msg)
if num < 0:
msg = "%s must not be negative: %s" % (name, num)
raise argparse.ArgumentTypeError(msg)
if unit == Unit.cm:
num = cm_to_pt(num)
elif unit == Unit.mm: