Memory leak in nss_cms_before_data
Categories
(NSS :: Libraries, defect, P1)
Tracking
(Not tracked)
People
(Reporter: mdauer, Assigned: djackson)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fuzzblocker])
Attachments
(6 files)
|
86 bytes,
application/octet-stream
|
Details | |
|
28 bytes,
application/octet-stream
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
OSS-Fuzz: https://oss-fuzz.com/testcase-detail/5675185185554432
Details
The NSSCMSDecoderContext allocated in nss_cms_before_data is never free'd:
childp7dcx = PORT_ZNew(NSSCMSDecoderContext);
To reproduce, perform the following steps:
- Build NSS with
./build.sh -c --fuzz --disable-tests - Run
/path/to/dist/Debug/bin/nssfuzz-smime /path/to/testcase
Comment 1•1 year ago
|
||
The severity field is not set for this bug.
:beurdouche, could you have a look please?
For more information, please visit BugBot documentation.
| Reporter | ||
Updated•1 year ago
|
| Assignee | ||
Updated•11 months ago
|
| Assignee | ||
Updated•11 months ago
|
| Reporter | ||
Comment 2•11 months ago
|
||
Just sharing what I found since I spent quite some time looking into this, but couldn't find a fix:
So, the allocated childp7dxc should in theory get free'd again in nss_cms_after_data here. nss_cms_after_data is called by nss_cms_decoder_notify here and is the notify callback for the ASN1 decoder. My guess would be that we reach a state in the ASN1 decoder where sec_asn1d_notify_after should be called, but isn't. I think the last state->place was duringSequence. Setting DEBUG_ASN1D_STATE was quite useful, though you may need to remove the state->place >= 0 checks to get it to compile.
| Reporter | ||
Comment 3•11 months ago
•
|
||
Attaching the minimized testcase from OSS-Fuzz
| Assignee | ||
Comment 4•11 months ago
|
||
| Assignee | ||
Comment 5•11 months ago
|
||
| Assignee | ||
Comment 6•11 months ago
|
||
| Assignee | ||
Comment 7•11 months ago
|
||
| Assignee | ||
Comment 8•11 months ago
•
|
||
https://hg-edge.mozilla.org/projects/nss/rev/b8b8f1cf7caa1e457b226f6e1bdcc3a2b2978e69
https://hg-edge.mozilla.org/projects/nss/rev/b4e99b13cbb6219a84dce0903a0063f94dc55c79
https://hg-edge.mozilla.org/projects/nss/rev/5ab653677c69a813e304220597422654fec05e38
| Assignee | ||
Updated•11 months ago
|
Description
•