From 20016aa63e43c5f9e64e837d7cab0eafcd7bf2a0 Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Mon, 23 Sep 2024 16:03:56 +0200 Subject: [PATCH] Fix multiple empty strings --- include/siri/version.h | 4 ++-- src/siri/db/points.c | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/siri/version.h b/include/siri/version.h index e0fcbe6b..b9d4a17f 100644 --- a/include/siri/version.h +++ b/include/siri/version.h @@ -6,7 +6,7 @@ #define SIRIDB_VERSION_MAJOR 2 #define SIRIDB_VERSION_MINOR 0 -#define SIRIDB_VERSION_PATCH 51 +#define SIRIDB_VERSION_PATCH 52 /* * Use SIRIDB_VERSION_PRE_RELEASE for alpha release versions. @@ -15,7 +15,7 @@ * Note that debian alpha packages should use versions like this: * 2.0.34-0alpha0 */ -#define SIRIDB_VERSION_PRE_RELEASE "" +#define SIRIDB_VERSION_PRE_RELEASE "-alpha-0" #ifndef NDEBUG #define SIRIDB_VERSION_BUILD_RELEASE "+debug" diff --git a/src/siri/db/points.c b/src/siri/db/points.c index e1004bbe..d0759f55 100644 --- a/src/siri/db/points.c +++ b/src/siri/db/points.c @@ -1118,7 +1118,6 @@ static int POINTS_unpack_string( { /* literal */ size_t len = (is_ascii) ? 0 : POINTS_dec_len(&pt); - do { *buf = *pt; @@ -1228,12 +1227,6 @@ int siridb_points_unzip_string( memcpy(&point->ts, pt, sizeof(uint64_t)); pt += sizeof(uint64_t); - buf = malloc(src_sz); - if (buf == NULL) - { - return -1; - } - for (mask = 0; tshift-- > tcount; ++pt) { mask |= ((uint64_t) *pt) << (tshift * 8); @@ -1265,6 +1258,12 @@ int siridb_points_unzip_string( n -= i; + buf = malloc(src_sz + n); + if (buf == NULL) + { + return -1; + } + if (POINTS_unpack_string( points->data + points->len, n, i, bits + offset, buf)) {