Skip to content

Commit 65a504a

Browse files
committed
fix: reserve payload header space when growing encode buffer
the header bytes are accounted for on the first row
1 parent 98b7145 commit 65a504a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/cloudsync.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,8 @@ bool cloudsync_buffer_free (cloudsync_data_payload *payload) {
19271927
}
19281928

19291929
bool cloudsync_buffer_check (cloudsync_data_payload *payload, size_t needed) {
1930+
if (payload->nrows == 0) needed += sizeof(cloudsync_payload_header);
1931+
19301932
// alloc/resize buffer
19311933
if (payload->bused + needed > payload->balloc) {
19321934
if (needed < CLOUDSYNC_PAYLOAD_MINBUF_SIZE) needed = CLOUDSYNC_PAYLOAD_MINBUF_SIZE;
@@ -3558,4 +3560,3 @@ APIEXPORT int sqlite3_cloudsync_init (sqlite3 *db, char **pzErrMsg, const sqlite
35583560

35593561
return cloudsync_register(db, pzErrMsg);
35603562
}
3561-

src/cloudsync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
extern "C" {
2121
#endif
2222

23-
#define CLOUDSYNC_VERSION "0.8.55"
23+
#define CLOUDSYNC_VERSION "0.8.56"
2424

2525
int sqlite3_cloudsync_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
2626

0 commit comments

Comments
 (0)