mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
sqlite3: reject negative arraysize values (#7238)
This commit is contained in:
1 parent
f8d8e25de4
commit
f7fe9c53cb
2 files changed
+8
-2
No files matched your search
Vendored
-1
@@ -1088,7 +1088,6 @@ class CursorTests(unittest.TestCase):
|
||||
|
||||
self.assertEqual(len(res), 2)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON arraysize validation not implemented
|
||||
def test_invalid_array_size(self):
|
||||
UINT32_MAX = (1 << 32) - 1
|
||||
setter = functools.partial(setattr, self.cu, 'arraysize')
|
||||
|
||||
@@ -1955,9 +1955,16 @@ mod _sqlite3 {
|
||||
fn arraysize(&self) -> c_int {
|
||||
self.arraysize.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
#[pygetset(setter)]
|
||||
fn set_arraysize(&self, val: c_int) {
|
||||
fn set_arraysize(&self, val: c_int, vm: &VirtualMachine) -> PyResult<()> {
|
||||
if val < 0 {
|
||||
return Err(vm.new_value_error("arraysize may not be negative"));
|
||||
}
|
||||
|
||||
self.arraysize.store(val, Ordering::Relaxed);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn build_row_cast_map(
|
||||
|
||||
Reference in new issue
Block a user