Closed Bug 141818 Opened 22 years ago Closed 20 years ago

Table with large rowspans and colspans hangs the browser

Categories

(Core :: Layout: Tables, defect, P3)

x86
All
defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: amar, Assigned: bernd_mozilla)

References

(Blocks 1 open bug, )

Details

(4 keywords, Whiteboard: [sg:dos] have patch)

Attachments

(7 files)

From Bugzilla Helper:
User-Agent: Mozilla/4.79 [en] (Windows NT 5.0; U)
BuildID:    


 In the following code the table has large rowspan="999999". When I load this 
table our browser hangs and utilise 100% memory.

<html>
<body>

<table class="DataBg" border="0" cellpadding="0" cellspacing="1" >

 <td align="center" class="DataHeader" width="2"
rowspan="9999999">&nbsp;</td>
    <td align="center" class="DataHeader" colspan="3"><div
class="margin3">Allocation Probability (%)</div></td>
  </tr>
</table>

</body>
</html> 

Reproducible: Always
Steps to Reproduce:
1.Load the testcase in the latest build
2.It hangs the browser.
3.

Actual Results:  Browser hangs and utilises 100% memory.

Expected Results:  Should not hang.
Attached file testcase attached
Keywords: testcase
Priority: -- → P3
it hangs with mozilla rc2 build.
so add hang to it.
Keywords: hang
Mozilla 2002062808. Linux/i686.

Bumping severity to major. This bug has a potential to make serious problems -
mozilla allocates gobs of RAM and can easily trigger OOM killer in Linux, which
in turn can take down the X session.

Do not visit above URL if you have anything important running!
Severity: normal → major
OS: Windows 2000 → All
Same hang at http://www.ncbi.nlm.nih.gov/cgi-bin/COG/palox?AF2220, which uses
rowspan=268580848.  Mozilla grabbed about 400 MB before I killed it.
Target Milestone: --- → Future
See also bug 86293, crash with large colspan (rather than rowspan).
*** Bug 182196 has been marked as a duplicate of this bug. ***
Severity: major → critical
Attached patch patchSplinter Review
taking the bug
Assignee: karnaze → bernd_mozilla
Attachment #110010 - Flags: superreview?(roc+moz)
Attachment #110010 - Flags: review?(karnaze)
Looks good, but there is one problem in celldata.h getting the rowspan:
    return (PRUint32)((mBits & ROW_SPAN_OFFSET) >> ROW_SPAN_SHIFT);

mBits is signed and ROW_SPAN_OFFSET includes the sign bit, so the right shift
will propagate the sign bit, so this will return the wrong result. I suggest you
change the declaration of mBits to be PRUint32 instead of 'long'.
#include <stdio.h>
#define  foo 0xFFF80000
void main(void)
{
 long l1;
 l1 = 0x80000000;
 printf("%ld", ((l1 & foo) >> 19) );
}

This code returns on my machine 4096 as expected. I dont think we need to
reorganize celldata. You would be right if math operations would be included but
here this are pure bit manipulations. Further I would like to avoid to change
the type. Currently tables also work on 64 bit wide machines, with your proposed
change I would need to test it on such a machine, which I dont have. 
Attachment #110010 - Flags: review?(karnaze) → review+
#include <stdio.h>

int main() {
  int i = 0x80000000;
  int foo = 0xFFF80000;
  printf("%d\n", i >> 16);
  printf("%d\n", (i & foo) >> 16);
  printf("%d\n", (i & 0xFFF80000) >> 16);
}

[roca@majesty tmp]$ gcc -o test test.c ; ./test
-32768
-32768
32768

Unfortunately I don't have a copy of the C standard with me, but I believe the
exact behaviour here is not specified. In this case perhaps 0xFFF80000 is being
treated as an unsigned value and gcc decides that (signed)&(unsigned) should be
unsigned. (Although that seems wrong to me; I would have expected 0xFFF80000 to
be signed and 0xFFF80000U to be the unsigned version.) In that case the
particular code you wrote is OK but I'm still not comfortable with it; it's too
easy to get wrong by writing the code slightly differently in a way that
everyone would believe "should" be equivalent.

A different way to get around this would be to do the shift first and then apply
the mask.

I wouldn't worry about the 64-bit machines; I'm pretty sure PRUint32 will be
fine there.
Attachment #111934 - Flags: superreview?(roc+moz)
Comment on attachment 110010 [details] [diff] [review]
patch

sr=roc+moz
Attachment #110010 - Flags: superreview?(roc+moz) → superreview+
Comment on attachment 111934 [details] [diff] [review]
changes to celldata.h

r+sr=roc+moz
Attachment #111934 - Flags: superreview?(roc+moz)
Attachment #111934 - Flags: superreview+
Attachment #111934 - Flags: review+
fix checked in, it fixes the rowspan issue, but the url in this still locks the
 viewer due to the combination of a large rowspan and colspan value.
*** Bug 192229 has been marked as a duplicate of this bug. ***
This checkin has caused a regression in layout for 64-bit builds (Bug 194726).
*** Bug 203880 has been marked as a duplicate of this bug. ***
JFYI, don't have any problems neither with testcase nor with url with Mozilla
1.4 on Linux
*** Bug 229445 has been marked as a duplicate of this bug. ***
Blocks: 234240
*** Bug 265846 has been marked as a duplicate of this bug. ***
*** Bug 267199 has been marked as a duplicate of this bug. ***
I have hit for the third time today a site defacement that used this bug to
crash every Mozilla/Firefox user that accessed that page. I've also received a
spam html mail some time ago which used this same bug (perhaps a revenge since
we have a builtin junk filter?).

I think it is about time to give some attention to this bug, since it is
becoming well-known among lammers and script-kiddies that want to annoy mozilla
users.
Flags: blocking1.8a5?
*** Bug 267634 has been marked as a duplicate of this bug. ***
Flags: blocking1.8a5? → blocking1.8a5+
This WFM with the latest Firefox 1.0 build and Mozilla 1.8a5 trunk build on Windows.

For those who do crash, please provide a talkback ID.
Also, the URL given is no longer valid and the test case provided doesn't crash.
 So please provide what web sites (exact URL) you're crashing at.
AFAIK both patches attached to this bug report have been checked into the trunk.
Glad I didn't do a WFM on this. When using the example URL from Bug #267634 I
got high CPU usage and an increasing amount of RAM allocated to the process.
Killed the process when it hit 256Meg (I've got 1Gig installed).

http://einsteinmg.dyndns.org/cgi-bin/remangle.cgi?=0x70b0e8ce

WinXP SP2, Firefox 1.0
this testcase from the dupe bug 267199 also causes a hang for me (not a crash,
so no talkback):
https://bugzilla.mozilla.org/attachment.cgi?id=164215&action=view
using Firefox 1.0 release build on win2000.

As comment 15 said, it now needs both a high rowspan and colspan to cause the
problem (which the URL in this bug had but the testcase doesn't)
Ouch!! 
With the latest provided testcase, seamonkey trunk hangs.  Had to hard restart
the system.  Either the fixes didn't make it into the seamonkey trunk or they
are inneffective.
You can view the profile at:

jar:https://bugzilla.mozilla.org/attachment.cgi?id=165723&action=view!/jprof2.html

Short summary:

Total hit count: 77385

  73036 nsCellMap::AppendCell

That time is about evenly split between:

  39147 operator new(unsigned) [mostly inside __libc_malloc here]

and

  20849 nsCellMap::SetDataAt(nsTableCellMap&, CellData&, int, int, int)

hmmm even opera does the same.
updating summary to reflect the issue this bug is now addressing (AIUI)
Summary: Table with large rowspans hangs the browser. → Table with large rowspans and colspans hangs the browser
Attached patch patchSplinter Review
Attachment #165779 - Flags: superreview?(bzbarsky)
Attachment #165779 - Flags: review?(bzbarsky)
Comment on attachment 165779 [details] [diff] [review]
patch

r+sr=bzbarsky
Attachment #165779 - Flags: superreview?(bzbarsky)
Attachment #165779 - Flags: superreview+
Attachment #165779 - Flags: review?(bzbarsky)
Attachment #165779 - Flags: review+
Comment on attachment 165779 [details] [diff] [review]
patch

fixed on trunk, this is IMHO branch worthy
Attachment #165779 - Flags: approval1.7.x?
fixed on trunk remove blocking mark
Flags: blocking1.8a5+
*** Bug 270427 has been marked as a duplicate of this bug. ***
Comment on attachment 165779 [details] [diff] [review]
patch

if this didn't go into Firefox 1.0's gecko, then it shouldn't land for 1.7.5
Attachment #165779 - Flags: approval1.7.x? → approval1.7.x-
I am thick of that a+/- business, closing this bug if somebody want this checked
in into any branch, 1. take the bug 2. ask for a 3. checked it in yourself.
Trunk works. Game over.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
*** Bug 276139 has been marked as a duplicate of this bug. ***
*** Bug 291402 has been marked as a duplicate of this bug. ***
Flags: blocking1.7.8?
Flags: blocking-aviary1.0.4?
Whiteboard: [sg:dos]
Lot of dupes on this one recently, might be worth taking as a stability fix on
the branches
Flags: blocking1.7.8?
Flags: blocking1.7.8+
Flags: blocking-aviary1.0.4?
Flags: blocking-aviary1.0.4+
*** Bug 293011 has been marked as a duplicate of this bug. ***
Flags: blocking-aviary1.0.4?
Flags: blocking-aviary1.0.4? → blocking-aviary1.0.4-
Whiteboard: [sg:dos] → [sg:dos] have patch
Bernd:  This is +'d for 1.0.5, can you put together a patch for the Aviary branch?  
Attachment #185587 - Flags: approval1.7.9?
Attachment #185587 - Flags: approval-aviary1.0.5?
Since bz is on vacation, can someone please r+sr the branch patch so we can
approve it for 1.0.5 and 1.7.9?  Dveditz, jst?
the branch patch is identical to the trunk version, so I don't see why an
additional r/sr should be necessary
Attachment #185587 - Flags: superreview+
Attachment #185587 - Flags: review+
bernd: Sorry, I realized that after I posted the comment.  

dveditz: I don't have permission to approve, so can you do the a= so we can get
this checked in?  Thanks.
Comment on attachment 185587 [details] [diff] [review]
patch updated to branch

a=dveditz for 1.0.5/1.7.9
Attachment #185587 - Flags: approval1.7.9?
Attachment #185587 - Flags: approval1.7.9+
Attachment #185587 - Flags: approval-aviary1.0.5?
Attachment #185587 - Flags: approval-aviary1.0.5+
Please add the fixed-aviary1.0.5 and fixed1.7.9 keywords when this lands on the
branches.
Flags: blocking1.7.8+ → blocking1.7.9+
fix checked in on branches
I wasn't able to crash firefox when viewing the test cases here (the ones that
didn't yield 404 errors). verifying as fixed with 200506170x-1.0.5 firefox
builds on linux fc3 and mac os x 10.4.1.
Status: RESOLVED → VERIFIED
v.fixed on aviary with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.9)
Gecko/20050706 Firefox/1.0.5 using attached testcase.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: