From 5b7f93bb9a5320201785cd0cb78dc7fe3afbb989 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Mon, 3 Aug 2020 12:25:14 +0200 Subject: [PATCH] do not allow negative values in parse_num() --- src/img2pdf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/img2pdf.py b/src/img2pdf.py index b9dd1fd..e944d99 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -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: