Closed Bug 1552363 Opened 5 years ago Closed 4 years ago

[Automated review] Non-static class member field "span.last" is not initialized in this constructor nor in any functions that it calls

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(firefox73 fixed)

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: sfink, Assigned: sfink)

Details

Attachments

(1 file)

https://phabricator.services.mozilla.com/D30103?id=105050#inline-185350

This is incorrect. The constructor calls init(), which calls reset(), which assigns the whole 'span' field by copying from another FreeSpan object.

I guess it could be claiming that the firstFreeSpan doesn't always initialize its .last field? I don't know how far it chases through data flow.

I see init() being called only in the explicit ctor but in the default one we only set some member variables but we don't set span.

The priority flag is not set for this bug.
:sylvestre, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(sledru)

Steve what d you think about what I said in my previous message, do you think we should fix this by also initializing span in the default ctor? Otherwise I think we should close this bug.

Flags: needinfo?(sledru) → needinfo?(sphink)
Assignee: nobody → sphink

Sorry, you are correct, this was a real bug. I don't think it mattered in practice, because init() would always end up getting called, but the analysis is absolutely correct that this produces an opportunity to use the class in a way that would use uninitialized memory.

Thanks!

Flags: needinfo?(sphink)
Pushed by sfink@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb6ec14a123a
Initialize FreeSpan in default constructor r=jonco
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: