Closed
Bug 1296286
Opened 9 years ago
Closed 9 years ago
[Static Analysis][Resource leak] In function Base64DecodeHelper
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: andi, Assigned: andi)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, Whiteboard: CID 1368949)
Attachments
(1 file)
The Static Analysis tool Coverity detected that a resource leak may happen in the following context:
>> if (!PL_Base64Decode(aBase64, aBase64Len, aBinary)) {
>> return NS_ERROR_INVALID_ARG;
>> }
This could be true only if |aBinary| is null and decode fails:
>> status = decode((const unsigned char *)src, srclen, (unsigned char *)dest);
>> if( PR_SUCCESS != status )
>> {
>> if( PR_TRUE == allocated )
>> {
>> PR_DELETE(dest);
>> }
>>
>> return (char *)0;
>> }
In our case aBinary is never passed as null but though in order to silence this checker we should add a MOZ_ASSERT before the call of PL_Base64Decode
Comment hidden (mozreview-request) |
Assignee | ||
Comment 2•9 years ago
|
||
Just to clear something up: decoder should NOT fail in order to have the leak.
![]() |
||
Comment 3•9 years ago
|
||
mozreview-review |
Comment on attachment 8782443 [details]
Bug 1296286 - preventfalse positive resource leak trigger in Base64DecodeHelper.
https://reviewboard.mozilla.org/r/72618/#review70296
Sure.
Attachment #8782443 -
Flags: review?(nfroyd) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fe2f3a5598cc
preventfalse positive resource leak trigger in Base64DecodeHelper. r=froydnj
Comment 5•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•