Crash while using libbson

Hi all,

I am facing a crash while trying to run a simple libbson test code. I have a large string in json format more than 3GB in size and that I am trying to write using below
bson_init_from_json(&bson, string.c_str(), string.size(), NULL)
which is throwing assertion deep inside at

static bool _bson_append_bson_end (bson_t *bson,  /* IN */
                       bson_t *child) /* IN */
{
   BSON_ASSERT (bson);
   BSON_ASSERT ((bson->flags & BSON_FLAG_IN_CHILD));
   BSON_ASSERT (!(child->flags & BSON_FLAG_IN_CHILD)); <-- this assertion is hit

My question is - is there any limitation on size json string which can be given to above function? If not how do I debug this issue?

Thanks.