mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix off-by-one error in SQL length limit check (#5982)
This commit is contained in:
1 parent
f465af3a7c
commit
5957f5d31a
2 files changed
+1
-4
No files matched your search
-2
@@ -349,8 +349,6 @@ class RegressionTests(unittest.TestCase):
|
||||
self.assertRaises(UnicodeEncodeError, cur.execute, "select '\ud8ff'")
|
||||
self.assertRaises(UnicodeEncodeError, cur.execute, "select '\udcff'")
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_large_sql(self):
|
||||
msg = "query string is too large"
|
||||
with memory_database() as cx, cx_limit(cx) as lim:
|
||||
|
||||
@@ -2309,11 +2309,10 @@ mod _sqlite {
|
||||
));
|
||||
}
|
||||
let sql_cstr = sql.to_cstring(vm)?;
|
||||
let sql_len = sql.byte_len() + 1;
|
||||
|
||||
let db = connection.db_lock(vm)?;
|
||||
|
||||
db.sql_limit(sql_len, vm)?;
|
||||
db.sql_limit(sql.byte_len(), vm)?;
|
||||
|
||||
let mut tail = null();
|
||||
let st = db.prepare(sql_cstr.as_ptr(), &mut tail, vm)?;
|
||||
|
||||
Reference in new issue
Block a user