Closed Bug 317934 Opened 19 years ago Closed 19 years ago

CVE-2006-0294 [FIX]Crash with evil testcase, switching from position:relative to static

Categories

(Core :: Layout, defect, P1)

x86
All
defect

Tracking

()

VERIFIED FIXED
mozilla1.9alpha1

People

(Reporter: martijn.martijn, Assigned: bzbarsky)

Details

(5 keywords, Whiteboard: [sg:critical?])

Attachments

(3 files)

See upcoming testcase, when clicking on the button, current Mozilla builds crash.
This doesn't happen in Mozilla1.7.

Talkback ID: TB12309372W
0x00000000
nsIView::Destroy  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/view/src/nsView.cpp, line 307]
nsSplittableFrame::Destroy  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/generic/nsSplittableFrame.cpp, line 71]
nsPositionedInlineFrame::Destroy  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/generic/nsInlineFrame.cpp, line 1052]
nsFrameList::DestroyFrames  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/generic/nsFrameList.cpp, line 138]
nsPositionedInlineFrame::Destroy  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/generic/nsInlineFrame.cpp, line 1052]
nsBlockFrame::RemoveFrame  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/generic/nsBlockFrame.cpp, line 5516]
nsFrameManager::RemoveFrame  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/base/nsFrameManager.cpp, line 704]
nsCSSFrameConstructor::ContentRemoved  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/base/nsCSSFrameConstructor.cpp, line 9946]
nsCSSFrameConstructor::RecreateFramesForContent  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/base/nsCSSFrameConstructor.cpp, line 11495]
nsCSSFrameConstructor::RestyleElement  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/base/nsCSSFrameConstructor.cpp, line 10377]
nsCSSFrameConstructor::ProcessOneRestyle  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/base/nsCSSFrameConstructor.cpp, line 13211]
nsCSSFrameConstructor::ProcessPendingRestyles  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/base/nsCSSFrameConstructor.cpp, line 13259]
nsCSSFrameConstructor::RestyleEvent::HandleEvent  [c:/builds/tinderbox/Fx-Trunk/WINNT_5.2_Depend/mozilla/layout/base/nsCSSFrameConstructor.cpp, line 13324]
SHELL32.dll + 0x520c24 (0x778b0c24)
Attached file testcase
Severity: normal → critical
testcase crashes 1.5rc3 on OS/2
OS: Windows XP → All
Attached file valgrind log
I crashed with builds back to 2005-06-10 but then couldn't crash with any build.  valgrind caught it trying to use already-freed memory.
I see this only when we process the restyle for the inner <q> first.  Then when we're processing the restyle for the outer <q> we get to destroying the brand-new frame the inner restyle created for the positioned <span> and crash when trying to delete its view...
The inner frame shouldn't have a view anymore ... did we somehow fail to remove the view from its parent when we reframed the inner element?
This looks like a regression from bug 292116 -- changing the parent means we get a mismatch between the frame and view trees....
Attachment #204322 - Flags: superreview?(roc)
Attachment #204322 - Flags: review?(roc)
Assignee: nobody → bzbarsky
Group: security
Flags: blocking1.8.1?
Flags: blocking1.8.0.1?
Priority: -- → P1
Summary: Crash with evil testcase, switching from position:relative to static → [FIX]Crash with evil testcase, switching from position:relative to static
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 204322 [details] [diff] [review]
This should fix it...

don't you need to initialize appendAfterFrame to nsnull to avoid a 'possible use of uninitialized' warning?
Attachment #204322 - Flags: superreview?(roc)
Attachment #204322 - Flags: superreview+
Attachment #204322 - Flags: review?(roc)
Attachment #204322 - Flags: review+
I didn't get those warnings when I compiled, so I assumed that gcc is finally sorta-smart enough...

I'll init them if warnings appear when I check in.
Fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment on attachment 204322 [details] [diff] [review]
This should fix it...

This is a double-delete, hence potentially exploitable... I think we should take this on the 1.8 branch, after it bakes on the trunk a tad.
Attachment #204322 - Flags: approval1.8.0.1?
I can't speak to any *potential* regressions, but the crash itself is certainly fixed in trunk build 2005-11-29-09 of SeaMonkey trunk on Windows XP.

Verified (trunk)
Status: RESOLVED → VERIFIED
Comment on attachment 204322 [details] [diff] [review]
This should fix it...

Please land on 1.8 and 1.8.1 branches.
Attachment #204322 - Flags: approval1.8.1+
Attachment #204322 - Flags: approval1.8.0.1?
Attachment #204322 - Flags: approval1.8.0.1+
Could someone please land this for me?  If not, I'll do it in early January...
Flags: blocking1.8.1?
Flags: blocking1.8.1+
Flags: blocking1.8.0.1?
Flags: blocking1.8.0.1+
*** Committing to MOZILLA_1_8_BRANCH... 
nsCSSFrameConstructor.h
new revision: 1.187.6.4; previous revision: 1.187.6.3
nsCSSFrameConstructor.cpp
new revision: 1.1110.6.13; previous revision: 1.1110.6.12

*** Committing layout/base/nsCSSFrameConstructor.cpp on MOZILLA_1_8_0_BRANCH... 
new revision: 1.1110.6.12.2.1; previous revision: 1.1110.6.12
*** Committing layout/base/nsCSSFrameConstructor.h on MOZILLA_1_8_0_BRANCH... 
new revision: 1.187.6.3.2.1; previous revision: 1.187.6.3
v.fixed on 1.8.0.1 with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1, no crash with testcase in comment #1
v test case does not crash 1.8.0.1, 1.8.1, 1.9a1 windows/linux
Flags: testcase?
Flags: testcase? → testcase+
Whiteboard: [sg:critical?]
Flags: blocking1.7.13-
Flags: blocking-aviary1.0.8-
Summary: [FIX]Crash with evil testcase, switching from position:relative to static → CVE-2006-0294 [FIX]Crash with evil testcase, switching from position:relative to static
Group: security
Flags: in-testsuite+ → in-testsuite?
crash test landed
http://hg.mozilla.org/mozilla-central/rev/876c3596f749
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: