bson before 0.8 incorrectly uses int rather than size_t for many variables, parameters, and return values. In particular, the bson_ensure_space() parameter bytesNeeded could have an integer overflow via properly constructed bson input.
Created libbson tracking bugs for this issue:
Affects: epel-all [bug 1834705]
Affects: fedora-all [bug 1834706]
Created mongo-c-driver tracking bugs for this issue:
Affects: epel-all [bug 1834708]
Affects: fedora-all [bug 1834707]
This flaw does not affect versions of bson that are shipped with Red Hat Software Collections packages. The vulnerable code is present in an older version of bson.
There is an integer overflow vulnerability in bson_append_estart()'s local len variable which is of type uint32_t. This variable is passed to bson_ensure_space() which in turn uses it in a call to realloc(), causing a heap buffer overflow when provided crafted input which causes the output of strlen (which is a size_t) to trigger an int overflow, since len is of type uint32_t. These functions are located in bson.c.
For more details, see the code:
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):