mirror of
https://github.com/python/cpython.git
synced 2025-09-25 01:43:11 +00:00
Issue #17073: Fix some integer overflows in sqlite3 module.
This commit is contained in:
parent
d5327d95d2
commit
35c52b687f
8 changed files with 203 additions and 75 deletions
|
@ -76,6 +76,25 @@ class CollationTests(unittest.TestCase):
|
|||
except sqlite.OperationalError, e:
|
||||
self.assertEqual(e.args[0].lower(), "no such collation sequence: mycoll")
|
||||
|
||||
def CheckCollationReturnsLargeInteger(self):
|
||||
def mycoll(x, y):
|
||||
# reverse order
|
||||
return -((x > y) - (x < y)) * 2**32
|
||||
con = sqlite.connect(":memory:")
|
||||
con.create_collation("mycoll", mycoll)
|
||||
sql = """
|
||||
select x from (
|
||||
select 'a' as x
|
||||
union
|
||||
select 'b' as x
|
||||
union
|
||||
select 'c' as x
|
||||
) order by x collate mycoll
|
||||
"""
|
||||
result = con.execute(sql).fetchall()
|
||||
self.assertEqual(result, [('c',), ('b',), ('a',)],
|
||||
msg="the expected order was not returned")
|
||||
|
||||
def CheckCollationRegisterTwice(self):
|
||||
"""
|
||||
Register two different collation functions under the same name.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue