Skip to content

Commit 3f5ccae

Browse files
authored
Merge pull request #1872 from tursodatabase/lucio/1868
libsql: error on invalid frame_no on wal read
2 parents 0c5b83f + 189e49d commit 3f5ccae

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libsql/src/local/connection.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,13 @@ impl Connection {
462462
// and more efficient buffer usage for extracting wal frames and spliting them off.
463463
let mut buf = bytes::BytesMut::with_capacity(frame_size);
464464

465+
if frame_no == 0 {
466+
return Err(errors::Error::SqliteFailure(
467+
1,
468+
"frame_no must be non-zero".to_string(),
469+
));
470+
}
471+
465472
let rc = unsafe {
466473
libsql_sys::ffi::libsql_wal_get_frame(
467474
self.handle(),

0 commit comments

Comments
 (0)