зеркало из https://github.com/mozilla/gecko-dev.git
5c18ecad6b
Before bug 1412722, which removed the sentinels, the code looked like: if (rbp_r_c->Right()->Left()->IsBlack()) { At that point in the code, rbp_r_c is the root node of the tree. If rbp_r_c->Right() was the sentinel, ->Right()->Left() would be the sentinel too, and the sentinel is black. Which means the condition would be true. The code after was: if (rbp_r_c->Right() && (!rbp_r_c->Right()->Left() || rbp_r_c->Right()->Left()->IsBlack())) { The second half correctly deals with the case of rbp_r_c->Right()->Left() being the sentinel. But the first half now makes things different: ->Right() being null would correspond to the previous case where it was the sentinel, and the test would not return true in that case when it would have before. When ->Right() is not null, things are normal again. The correct check is to make the branch taken when ->Right() is null. Now, looking under which conditions we may get in that branch wrongly: - The root node's right link must be empty, which means a very small tree. - The comparison between the removed key and the root node must indicate the key is greater than the value of the root node. - There's another case where the comparison result (rbp_r_cmp) can be eGreater, when it is reassigned under one of the branches under the eEqual test, and that branch is only taken when ->Right() on the root node was non-null, which was the non-broken case. So it would seem we can't reach that code when rbp_r_c->Right() is null anyways, so it /should/ practically make no difference. Better safe than sorry, though. It's hard to tell anything from crash stats, because since the templatization in bug 1403444, all crashes fit in one bucket, when there used to be 5 functions before :( While here, add a missing include in rb.h. --HG-- extra : rebase_source : 2ebcb84345ad52059b0c081b9e2e1af1d0bbb7bc |
||
---|---|---|
.. | ||
Makefile.in | ||
Mutex.h | ||
Utils.h | ||
fallback.cpp | ||
malloc_decls.h | ||
moz.build | ||
mozjemalloc.cpp | ||
mozjemalloc.h | ||
mozjemalloc_types.h | ||
mozmemory.h | ||
mozmemory_wrap.cpp | ||
mozmemory_wrap.h | ||
rb.h | ||
replace_malloc.h | ||
replace_malloc_bridge.h | ||
zone.c |