Open Bug 1649114 Opened 5 years ago Updated 3 years ago

static analysis wrongly consideres dom::Selection's pointer as nsCSSPseudoElements::selection function

Categories

(Developer Infrastructure :: Source Code Analysis, defect, P2)

Tracking

(Not tracked)

People

(Reporter: Sylvestre, Unassigned)

References

(Blocks 1 open bug)

Details

https://searchfox.org/mozilla-central/source/dom/events/TextComposition.cpp#688-692
A static analyzer is complaining about if (!selection) {
with:

prefix with the address-of operator to silence this warning
address of function 'nsCSSPseudoElements::selection' will always evaluate to 'true'

masayuki, we should remove this check as it is misleading.
wdyt?

Flags: needinfo?(masayuki)

I think that is a bug in the static analyzer. selection is clearly a local variable, not the nsCSSPseudoElements::selection function.

Yeah, it's dom::Selection's pointer. I don't understand why it's considered as nsCSSPseudoElements::selection. And the check is reasonable if we put off creating Selection instances at first use.

Flags: needinfo?(masayuki)
Component: DOM: Editor → Source Code Analysis
Product: Core → Firefox Build System
Summary: address of function 'nsCSSPseudoElements::selection' will always evaluate to 'true' → static analysis wrongly consideres dom::Selection's pointer as nsCSSPseudoElements::selection function

The severity field is not set for this bug.
:andi, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bpostelnicu)
Severity: -- → S2
Flags: needinfo?(bpostelnicu)
Priority: -- → P2
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.