I get a shutdown crash in 22.214.171.124pre 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]
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:
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 126.96.36.199 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:
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
> + mNextSibling = *aNextSibling;
> I suggest moving both of those before the if, and changing it to:
This makes me a bit nervous about it:
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 188.8.131.52 and 184.108.40.206, 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/accessible/src/html/nsHTMLSelectAccessible.cpp 220.127.116.11 mozilla/accessible/src/html/nsHTMLSelectAccessible.h 18.104.22.168
mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp 22.214.171.124.2.2 mozilla/accessible/src/html/nsHTMLSelectAccessible.h 126.96.36.199.4.1
(trunk not affected)
Verified for 188.8.131.52 using Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:184.108.40.206pre) Gecko/20070822 BonEcho/220.127.116.11pre ID:2007082203 with the testcase from comment #1 and verified for 18.104.22.168 using Thunderbird 22.214.171.124 RC with Thunderbrowse - no crash
Adding verified keywords
re-adding fixed126.96.36.199 to record when the actual fix happened, even though verification was later due to firedrills.