Open Bug 1927188 Opened 2 years ago Updated 2 years ago

ApplyUpdates should treat outpid as optional

Categories

(Toolkit :: Application Update, defect)

defect

Tracking

()

People

(Reporter: bytesized, Unassigned)

References

Details

(Keywords: good-first-bug, Whiteboard: [fidedi-ope])

Was doing some work in nsUpdateDriver.cpp today and noticed that looks very wrong to me.

In several places in ApplyUpdate such as here, we dereference outpid without first checking that it is null. That value is passed in as an argument from ApplyUpdate's only caller, ProcessUpdates. ProcessUpdates directly passes its pid argument for outpid. And the pid argument is declared as optional with a default value of nullptr.

I believe that this is kinda-sorta safe for the moment. outpid is the outparam with which we return the PID of the update process that is doing staging. And we pass a non-null value here when we are staging. But we should fix this such that ApplyUpdate doesn't assume outpid will be non-null, since that isn't guaranteed at all.

Oh. I think that this usage actually could get hit when outpid is null. But the block it's in appears to be structured like this

#if defined(XP_UNIX) && !defined(XP_MACOSX)
// ...
#elif defined(XP_WIN)
// ...
#elif defined(XP_MACOSX)
// ...
#else
// questionable `outpid` usage
#endif

I think we probably never even compile that? Possibly we should replace that whole #else definition with something more like this.

You need to log in before you can comment on or make changes to this bug.