Closed Bug 1246925 Opened 4 years ago Closed 4 years ago

[Static Analysis][Explicit null dereferenced] In function RefPtr<NrIceCtx> NrIceCtx::Create

Categories

(Core :: WebRTC: Networking, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1352017 )

Attachments

(1 file)

The Static Analysis tool Coverity added that pointers filtering_type and mapping_type might be explicitly null dereferenced:

>>    MOZ_MTLOG(ML_DEBUG, "NAT filtering type: " << filtering_type);
>>    MOZ_MTLOG(ML_DEBUG, "NAT mapping type: " << mapping_type);

Judging by the looks of the code these pointers are null tested in:

>>  if (mapping_type && filtering_type) {
>>    TestNat* test_nat = new TestNat;
>>    test_nat->filtering_type_ = TestNat::ToNatBehavior(filtering_type);
>>    test_nat->mapping_type_ = TestNat::ToNatBehavior(mapping_type);
>>    test_nat->block_udp_ = block_udp;

I case filtering_type and mapping_type are null a null pointer dereference will occur only log level for this component is set to Verbose but still i think we should move the logging code inside the if statement.
Comment on attachment 8717419 [details]
MozReview Request: Bug 1246925 - log filtering_type and mapping_type only if they are valid pointers. r?ekr

https://reviewboard.mozilla.org/r/34175/#review30855
Attachment #8717419 - Flags: review?(ekr) → review+
since autoland is down setting it to checking-needed
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/557693d740ec
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.