commit 46acf676718791a2f6ce6f17fdd0b2af2046ca2e
parent 9ce98a2a733e91facff9dbc03f62d4d0e1fd1de3
Author: William Casarin <jb55@jb55.com>
Date: Mon, 17 Feb 2025 15:13:17 -0800
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/src/nostrdb.c b/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