ptpb / pb

pb is a formerly-lightweight pastebin and url shortener
Other
549 stars 52 forks source link

Enormous sunsets #153

Closed sudokode closed 8 years ago

sudokode commented 8 years ago

While this is fixable within pbwww, it's really a bug on the backend.

curl -F c=@- -F sunset=9999999999999999 https://ptpb.pw <<< "42352342436552342rsdfgsdgsdfg"

Returns a 500 Internal Server Error.

buhman commented 8 years ago
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/flask/app.py", line 1967, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.5/site-packages/flask/app.py", line 1620, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.5/site-packages/flask/app.py", line 1523, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/lib/python3.5/site-packages/flask/app.py", line 1618, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.5/site-packages/flask/app.py", line 1604, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/zack/pb/pb/paste/views.py", line 78, in post
    args[key] = parse_sunset(value)
  File "/home/zack/pb/pb/util.py", line 129, in parse_sunset
    return f(sunset.strip())
  File "/home/zack/pb/pb/util.py", line 126, in f
    return date + timedelta(seconds=int(sunset))
OverflowError: normalized days too large to fit in a C int
buhman commented 8 years ago

Could easily catch that, but I'm just going to roll the shit downhill and say "python's fault for not supporting arbitrarily large datetimes".

buhman commented 8 years ago

fb3f6cf8ab0b799786d956f442e709d2c6b2417c

sudokode commented 8 years ago

:+1: