mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 09:44:21 +01:00
Merge 'Update the write_varint method to use an encoded buffer of size 9 instead of 10.' from
The SQLite varint specification states that the varint is guaranteed to be a maximum of 9 bytes, but our version of write_varint initializes a buffer of 10 bytes. Changing the size to match the specification. We could put an assert to check that the 10th byte is never written to but, reducing the size seems like the correct thing to do based on the specification. Varint constraints are mentioned in this specification: https://www.sqlite.org/fileformat.html Closes #3835
This commit is contained in:
@@ -1601,7 +1601,7 @@ pub fn write_varint(buf: &mut [u8], value: u64) -> usize {
|
||||
return 9;
|
||||
}
|
||||
|
||||
let mut encoded: [u8; 10] = [0; 10];
|
||||
let mut encoded: [u8; 9] = [0; 9];
|
||||
let mut bytes = value;
|
||||
let mut n = 0;
|
||||
while bytes != 0 {
|
||||
|
||||
@@ -130,7 +130,7 @@ pub fn write_varint(buf: &mut [u8], value: u64) -> usize {
|
||||
return 9;
|
||||
}
|
||||
|
||||
let mut encoded: [u8; 10] = [0; 10];
|
||||
let mut encoded: [u8; 9] = [0; 9];
|
||||
let mut bytes = value;
|
||||
let mut n = 0;
|
||||
while bytes != 0 {
|
||||
|
||||
Reference in New Issue
Block a user