Skip to content

Commit 8ec68b0

Browse files
author
martin.v.loewis
committed
Don't pass huge itemids into the backend.
[[Ralf Schlatterbeck: Note that the original patch wasn't python3 compatible and used long instead of int. Verified that python2.7 can deal with long numeric strings, e.g. 2**64 * 10: int("184467440737095516160")]] committer: Ralf Schlatterbeck <[email protected]>
1 parent 5587c20 commit 8ec68b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

roundup/cgi/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,10 @@ def determine_context(self, dre=re.compile(r'([^\d]+)0*(\d+)')):
13511351
klass = self.db.getclass(self.classname)
13521352
except KeyError:
13531353
raise NotFound('%s/%s'%(self.classname, self.nodeid))
1354+
if int(self.nodeid) > 2**31:
1355+
# Postgres will complain with a ProgrammingError
1356+
# if we try to pass in numbers that are too large
1357+
raise NotFound ('%s/%s'%(self.classname, self.nodeid))
13541358
if not klass.hasnode(self.nodeid):
13551359
raise NotFound('%s/%s'%(self.classname, self.nodeid))
13561360
# with a designator, we default to item view

0 commit comments

Comments
 (0)