commit 712624f51525e2f7f2bb632877c005b61e9b5300
parent 6e7b3b94d77da6b56f689b640c75de8c2aa9617d
Author: William Casarin <jb55@jb55.com>
Date: Mon, 17 Feb 2025 15:13:17 -0800
nostrdb: fix iOS crash on latest version
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c
@@ -2342,6 +2342,12 @@ static int ndb_ingester_queue_event(struct ndb_ingester *ingester,
static int ndb_ingest_event(struct ndb_ingester *ingester, const char *json,
int len, unsigned client)
{
+ // Without this, we get bus errors in the json parser inside when
+ // trying to ingest empty kind 6 reposts... we should probably do fuzz
+ // testing on inputs to the json parser
+ if (len == 0)
+ return 0;
+
// Since we need to return as soon as possible, and we're not
// making any assumptions about the lifetime of the string, we
// definitely need to copy the json here. In the future once we