[CDRIVER-1184] Segfault in bson_writer Created: 31/Mar/16  Updated: 03/May/17  Resolved: 01/Apr/16

Status: Closed
Project: C Driver
Component/s: libbson
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Paul Childs Assignee: A. Jesse Jiryu Davis
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 15.10 AMD64bit



 Description   

The following code creates the segfault when a sufficiently sized json file is used:
...
bwrit = bson_writer_new (&bbuf, &bblen, 0, bson_realloc_ctx, NULL);
bson_writer_begin(bwrit, &udt);
udt=bson_new_from_json((uint8_t*) jdat, -1, NULL);
bson_writer_end(bwrit);

The backtrace is as follows:

memset (__len=5, __ch=0, __dest=0x1) at /usr/include/x86_64-linux-gnu/bits/string3.h:90
bson_writer_begin (writer=writer@entry=0xe4b6b0, bson=bson@entry=0x7fffffffd480) at src/bson/bson-writer.c:205



 Comments   
Comment by A. Jesse Jiryu Davis [ 01/Apr/16 ]

Paul, please feel free to reopen this ticket with more info and we'll resume the investigation. Thanks.

Comment by Hannes Magnusson [ 31/Mar/16 ]

What is sufficiently sized json file?

I'm not able to reproduce this with a 50gb json file.
Does matter how many documents are in it? the size of the file? The length of the fields?

Comment by A. Jesse Jiryu Davis [ 31/Mar/16 ]

Thanks for the report, we'll investigate.

Generated at Wed Feb 07 21:11:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.