Skip to content
Disclosed report CVE-2012-1952

Bad cast in nsTableFrame::InsertFrames

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 5 days
  • Paid in 14 months
  • Disclosed after 5 days
Text
Created attachment 627858
Testcase

Reproduces on Firefox trunk
20120528230131
http://hg.mozilla.org/mozilla-central/rev/79262a88881d

First it hits the asserts here.

NS_IMETHODIMP
nsTableFrame::InsertFrames(ChildListID     aListID,
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList)
{
........
#ifdef DEBUG
  // verify that all sibling have the same type, if they do not, expect cellmap issues
  for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
    const nsStyleDisplay* nextDisplay = e.get()->GetStyleDisplay();
    NS_ASSERTION((display->mDisplay == NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP) ==
        (nextDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP),
      "heterogenous childlist");
  }
#endif

Bad cast happens here. We get a nsTableRowGroupFrame, which gets incorrectly casted to nsTableColGroupFrame.

void nsTableFrame::InsertColGroups(PRInt32                   aStartColIndex,
                                   const nsFrameList::Slice& aColGroups)
{
  PRInt32 colIndex = aStartColIndex;
  nsFrameList::Enumerator colGroups(aColGroups);
  for (; !colGroups.AtEnd(); colGroups.Next()) {
    nsTableColGroupFrame* cgFrame =
      static_cast<nsTableColGroupFrame*>(colGroups.get());

>	xul.dll!nsTableFrame::InsertColGroups(int aStartColIndex=0, const nsFrameList::Slice & aColGroups={...})  Line 546 + 0x10 bytes	C++
 	xul.dll!nsTableFrame::InsertFrames(mozilla::layout::FrameChildListID aListID=kPrincipalList, nsIFrame * aPrevFrame=0x00000000, nsFrameList & aFrameList={...})  Line 2240 + 0x10 bytes	C++
 	xul.dll!nsFrameManager::InsertFrames(nsIFrame * aParentFrame=0x059edd90, mozilla::layout::FrameChildListID aListID=kPrincipalList, nsIFrame * aPrevFrame=0x00000000, nsFrameList & aFrameList={...})  Line 500	C++
 	xul.dll!nsCSSFrameConstructor::AppendFramesToParent(nsFrameConstructorState & aState={...}, nsIFrame * aParentFrame=0x059edd90, nsFrameItems & aFrameList={...}, nsIFrame * aPrevSibling=0x00000000, bool aIsRecursiveCall=false)  Line 5728	C++
 	xul.dll!nsCSSFrameConstructor::ContentAppended(nsIContent * aContainer=0x059eff88, nsIContent * aFirstNewContent=0x050baec0, bool aAllowLazyConstruction=true)  Line 6660	C++
 	xul.dll!PresShell::ContentAppended(nsIDocument * aDocument=0x08218b70, nsIContent * aContainer=0x059eff88, nsIContent * aFirstNewContent=0x050baec0, int aNewIndexInContainer=1)  Line 4170	C++
 	xul.dll!nsNodeUtils::ContentAppended(nsIContent * aContainer=0x059eff88, nsIContent * aFirstNewContent=0x050baec0, int aNewIndexInContainer=1)  Line 148 + 0xce bytes	C++
 	xul.dll!nsHtml5PendingNotification::Fire()  Line 61 + 0x2b bytes	C++
 	xul.dll!nsHtml5TreeOpExecutor::FlushPendingAppendNotifications()  Line 324	C++
 	xul.dll!nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor * aBuilder=0x08219ab8, nsIContent * * aScriptElement=0x0014ce48)  Line 517	C++
 	xul.dll!nsHtml5TreeOpExecutor::RunFlushLoop()  Line 530	C++
 	xul.dll!nsHtml5ExecutorReflusher::Run()  Line 96	C++
 	xul.dll!nsThread::ProcessNextEvent(bool mayWait=false, bool * result=0x0014ceff)  Line 657 + 0x19 bytes	C++
 	xul.dll!NS_ProcessNextEvent_P(nsIThread * thread=0x008a9e38, bool mayWait=false)  Line 245 + 0x17 bytes	C++
 	xul.dll!mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate * aDelegate=0x008a69a8)  Line 110 + 0xe bytes	C++
 	xul.dll!MessageLoop::RunInternal()  Line 209	C++
 	xul.dll!MessageLoop::RunHandler()  Line 202	C++
 	xul.dll!MessageLoop::Run()  Line 176	C++
 	xul.dll!nsBaseAppShell::Run()  Line 191	C++
 	xul.dll!nsAppShell::Run()  Line 252 + 0x9 bytes	C++
 	xul.dll!nsAppStartup::Run()  Line 295 + 0x1c bytes	C++
 	xul.dll!XRE_main(int argc=1, char * * argv=0x00188010, const nsXREAppData * aAppData=0x012fb844)  Line 3703 + 0x25 bytes	C++
 	firefox.exe!do_main(int argc=1, char * * argv=0x00188010)  Line 190 + 0x13 bytes	C++
 	firefox.exe!NS_internal_main(int argc=1, char * * argv=0x00188010)  Line 277 + 0xd bytes	C++
 	firefox.exe!wmain(int argc=1, wchar_t * * argv=0x00181b90)  Line 107 + 0xd bytes	C++
 	firefox.exe!__tmainCRTStartup()  Line 583 + 0x19 bytes	C
 	firefox.exe!wmainCRTStartup()  Line 403	C

The original report as published on Mozilla's Bugzilla, by Abhishek Arya. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A critical-severity security bug in Layout: Tables. Mozilla made it public on 2 June 2012 as CVE-2012-1952.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

More by Abhishek Arya

View all

130 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.