mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-28 20:17:18 -06:00
PR218: check SQLite local payload span
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -284,7 +284,7 @@ impl Database {
|
||||
let local = if payload_len <= max_local {
|
||||
payload_len
|
||||
} else {
|
||||
let span = usable - 4;
|
||||
let span = usable.checked_sub(4).ok_or("SQLite usable page size is too small")?;
|
||||
let candidate = min_local.saturating_add(payload_len.checked_sub(min_local).ok_or("SQLite payload length is too small")? % span);
|
||||
if candidate > max_local { min_local } else { candidate }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user