Nanopb is a small code-size Protocol Buffers implementation in ansi C. In Nanopb before versions 0.3.9.8 and 0.4.5, decoding a specifically formed message can cause invalid free() or realloc() calls if the message type contains an oneof field, and the oneof directly contains both a pointer field and a non-pointer field. If the message data first contains the non-pointer field and then the pointer field, the data of the non-pointer field is incorrectly treated as if it was a pointer value. Such message data rarely occurs in normal messages, but it is a concern when untrusted data is parsed. This has been fixed in versions 0.3.9.8 and 0.4.5. See referenced GitHub Security Advisory for more information including workarounds.
[
{
"target": {
"function": "pb_release_union_field",
"file": "pb_decode.c"
},
"id": "CVE-2021-21401-1bc41359",
"signature_type": "Function",
"signature_version": "v1",
"deprecated": false,
"source": "https://github.com/nanopb/nanopb/commit/e2f0ccf939d9f82931d085acb6df8e9a182a4261",
"digest": {
"function_hash": "135569156852612219065699278227514311302",
"length": 325.0
}
},
{
"target": {
"file": "pb_decode.c"
},
"id": "CVE-2021-21401-ba7b2709",
"signature_type": "Line",
"signature_version": "v1",
"deprecated": false,
"source": "https://github.com/nanopb/nanopb/commit/e2f0ccf939d9f82931d085acb6df8e9a182a4261",
"digest": {
"line_hashes": [
"61013708987579731352987091476408286170",
"327087506916403461653276454963703349803",
"44894250810108914257220512929796472898"
],
"threshold": 0.9
}
}
]