I get a shutdown crash in 184.108.40.206pre debug builds after running the testcase from bug 377470 (https://bugzilla.mozilla.org/attachment.cgi?id=261540), stack as described at bug 377470 comment 9, dereferencing a deleted object. So far have not reproduced the crash in an optimized build.
Created attachment 270839 [details] stack trace nsHTMLComboboxAccessible::Init() creates the button and list accessibles into its members using GetNextSibling(). The problem is that the GetNextSibling methods uses mNextSibling to check if it should create its sibling or not, but doesn't actually assign it, so any subsequent call to GetNextSibling() will create a new ComboboxListAccessible object. ComboboxListAccessible caches up option accessibles effectively stealing the children of the previous one: http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp&rev=220.127.116.11&root=/cvsroot&mark=361#345 which now has an invalid mFirstChild pointer - which will eventually crash when nsAccessible::Shutdown tries to use it.
Created attachment 270841 [details] [diff] [review] Patch rev. 1 This should fix it I think. This code have been redesigned on trunk (bug 278034) so this looks like a branch-only bug.
I can reproduce this crash in Firefox 18.104.22.168 on Linux: TB33713986Z
Comment on attachment 270841 [details] [diff] [review] Patch rev. 1 Should nsHTMLComboboxAccessible::Shutdown() also manually shutdown the mComboboxTextFieldAccessible and mComboboxButtonAccessible (same as you did for the list)? + mNextSibling = *aNextSibling; I suggest moving both of those before the if, and changing it to: SetNextSibling(accessible);
Created attachment 270927 [details] [diff] [review] Patch rev. 2 (In reply to comment #4) > (From update of attachment 270841 [details] [diff] [review]) > Should nsHTMLComboboxAccessible::Shutdown() also manually shutdown the > mComboboxTextFieldAccessible and mComboboxButtonAccessible Sure. > + mNextSibling = *aNextSibling; > I suggest moving both of those before the if, and changing it to: > SetNextSibling(accessible); This makes me a bit nervous about it: http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/accessible/src/base/nsAccessible.cpp&rev=22.214.171.124&root=/cvsroot&mark=370#368 DEAD_END_ACCESSIBLE == 0x1 and the combobox accessible code in general doesn't look like it would behave well with mNextSibling == 0x1. I'd prefer to leave the null-ptr logic in these methods as is for now - I fear for regressions if we mess to much with it.
Guessing at security impact. Would a user need to install something to be vulnerable to web content doing what this testcase does, or would simply turning on a screenreader or the like be sufficient?
Comment on attachment 270927 [details] [diff] [review] Patch rev. 2 approved for 126.96.36.199 and 188.8.131.52, a=dveditz
(In reply to comment #6) Daniel, I think one can trick the AT into creating the right set of a11y nodes from unprivileged script by moving around focus or selection and then remove DOM nodes or restyle elements to cause the Shutdown() to happen. This would setup the necessary state for either accessing a dead node (bug 387252) or to steal the children (this bug) through a call to GetNextSibling(). So it comes down to if one can trick the AT to do a GetNextSibling() on the right node from script. It doesn't seem entirely impossible to me... Aaron? If my guess is right then simply turning on a screenreader or other AT would be sufficient.
MOZILLA_1_8_BRANCH: mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp 184.108.40.206 mozilla/accessible/src/html/nsHTMLSelectAccessible.h 220.127.116.11 MOZILLA_1_8_0_BRANCH: mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp 18.104.22.168.2.2 mozilla/accessible/src/html/nsHTMLSelectAccessible.h 22.214.171.124.4.1 (trunk not affected) -> FIXED
Verified for 126.96.36.199 using Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:188.8.131.52pre) Gecko/20070822 BonEcho/184.108.40.206pre ID:2007082203 with the testcase from comment #1 and verified for 220.127.116.11 using Thunderbird 18.104.22.168 RC with Thunderbrowse - no crash Adding verified keywords
re-adding fixed22.214.171.124 to record when the actual fix happened, even though verification was later due to firedrills.