more hardening
This commit is contained in:
parent
0b0efa0518
commit
686eda82b7
1 changed files with 3 additions and 3 deletions
|
|
@ -6,8 +6,8 @@ ENABLE_HARDENING = True
|
|||
def panic(reason:str):
|
||||
if not ENABLE_HARDENING:
|
||||
return
|
||||
logger.error(f"hardening error: {reason}")
|
||||
raise ValueError(f"hardening error: {reason}")
|
||||
logger.error(f"hardening: {reason}")
|
||||
raise ValueError(f"hardening: {reason}")
|
||||
|
||||
# Throw if string contains any non-printable characters
|
||||
def assert_printable(v:str):
|
||||
|
|
@ -81,7 +81,7 @@ def assert_valid_timestamp_seconds(v:int):
|
|||
if not ENABLE_HARDENING:
|
||||
return
|
||||
assert_valid_int(v)
|
||||
if v < 0:
|
||||
if v < 0 and v != -1:
|
||||
panic("timestamp is negative")
|
||||
if v > 2**31:
|
||||
panic("timestamp is too high")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue