From 712624f51525e2f7f2bb632877c005b61e9b5300 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 17 Feb 2025 15:13:17 -0800 Subject: [PATCH] nostrdb: fix iOS crash on latest version Signed-off-by: William Casarin --- nostrdb/src/nostrdb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c index 990bdf1d..f27ba7f8 100644 --- 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