Closed Bug 1290239 Opened 5 years ago Closed 5 years ago

HashNativeKey computes incorrect hash value when |mBaseSet| is null

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox50 --- affected
firefox51 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(2 files)

The hashing function for XPCNativeSetKey can be called with a null mBaseSet. In this case, it is supposed to compute the hash value for a new XPCNativeSet with mAddition added. It does this by computing the hash for a native set containing _only_ mAddition, but all XPCNativeSets also contain nsISupports as the first value, so that must be added into the hash value, too. I think the worst that can happen is that sometimes we end up with two copies of a native set floating around.
Assignee: nobody → continuation
In my patches for bug 1288909, I have to remove native sets from the native set map when they die, but this bug means that the map can contain a pointer to the set that is not removed when you call Remove() on that set.
Blocks: 1288909
Depends on: 1290614
You should review bug 1290614 first, if only to get a better sense of XPCNativeSetKey.
Comment on attachment 8779380 [details]
Bug 1290239, part 1 - Compute the correct hash value for an XPCNativeSetKey when mBaseSet is null.

https://reviewboard.mozilla.org/r/70370/#review67864
Attachment #8779380 - Flags: review?(mrbkap) → review+
Comment on attachment 8779381 [details]
Bug 1290239, part 2 - Add assertions about inserting into NativeSetMap.

https://reviewboard.mozilla.org/r/70372/#review67868
Attachment #8779381 - Flags: review?(mrbkap) → review+
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e582ee72021c
part 1 - Compute the correct hash value for an XPCNativeSetKey when mBaseSet is null. r=mrbkap
https://hg.mozilla.org/integration/autoland/rev/4eda5a74d949
part 2 - Add assertions about inserting into NativeSetMap. r=mrbkap
https://hg.mozilla.org/mozilla-central/rev/e582ee72021c
https://hg.mozilla.org/mozilla-central/rev/4eda5a74d949
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.