Open Bug 1276058 Opened 4 years ago Updated 2 years ago

Add static analysis check to ensure we use string converters properly

Categories

(Firefox Build System :: Source Code Analysis, defect)

defect
Not set

Tracking

(firefox49 affected)

Tracking Status
firefox49 --- affected

People

(Reporter: mconley, Unassigned)

Details

See this comment:

https://dxr.mozilla.org/mozilla-central/rev/8d0aadfe7da782d415363880008b4ca027686137/xpcom/string/nsTPromiseFlatString.h#35

Not sure if this is something we should be able to catch with static analysis, but thought I'd file this to see.
We can probably capture this with the use of a basic borrow checking analysis. Something like

MOZ_BORROWS_THIS

on a method. This would then tell the analysis that the return value of the function should be destroyed before the `this` parameter to the method is destroyed.

It could start out as only having an effect if it is called on a temporary, and then be expanded to work in more complex situations in the future.
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.