Skip to content

Commit

Permalink
Merge pull request #1872 from tursodatabase/lucio/1868
Browse files Browse the repository at this point in the history
libsql: error on invalid frame_no on wal read
  • Loading branch information
penberg authored Dec 10, 2024
2 parents 0c5b83f + 189e49d commit 3f5ccae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libsql/src/local/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,13 @@ impl Connection {
// and more efficient buffer usage for extracting wal frames and spliting them off.
let mut buf = bytes::BytesMut::with_capacity(frame_size);

if frame_no == 0 {
return Err(errors::Error::SqliteFailure(
1,
"frame_no must be non-zero".to_string(),
));
}

let rc = unsafe {
libsql_sys::ffi::libsql_wal_get_frame(
self.handle(),
Expand Down

0 comments on commit 3f5ccae

Please sign in to comment.