do not store digits value if outside integer range (#54702)

This commit is contained in:
Frédéric Péters 2021-06-09 14:29:31 +02:00 committed by Benjamin Dauvergne
parent f8c4a03464
commit 9bd160e0dd
1 changed files with 10 additions and 1 deletions

View File

@ -890,7 +890,16 @@ class WcsFormdefFeeder(object):
elif field.type == 'string':
if has_digits_validation(field):
if raw is not None and raw.isnumeric():
v = int(raw)
try:
v = int(raw)
except ValueError:
v = None
else:
if v > 2**31:
# do not store anything if outside range as it's
# probably not something we would use in arithmetic
# anyway (like a serial number)
v = None
else:
v = raw
elif field.type == 'bool':