diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-07 17:03:46 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-07 17:03:46 +0200 |
commit | 2efdc90b0f49866d857a5b3dc21b7c791f7a0aeb (patch) | |
tree | 5a929d957c94083e8ab89ca35cf05d7f00cc19e3 /Lib/sqlite3/test/hooks.py | |
parent | 03ee12ed7251b6b251d55d708a22616ed2538b19 (diff) | |
parent | 3cf96ac2484d093bea17610480efd0e88301f72a (diff) | |
download | cpython-git-2efdc90b0f49866d857a5b3dc21b7c791f7a0aeb.tar.gz |
Issue #17073: Fix some integer overflows in sqlite3 module.
Diffstat (limited to 'Lib/sqlite3/test/hooks.py')
-rw-r--r-- | Lib/sqlite3/test/hooks.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py index 0b5520d906..087edb03df 100644 --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -76,6 +76,25 @@ class CollationTests(unittest.TestCase): except sqlite.OperationalError as 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. |