Closed Bug 124218 Opened 23 years ago Closed 21 years ago

if kCSSRawKeywords gets out of sync with eCSSKeyword_COUNT nsCSSKeywords::AddRefTable might crash in DEBUG code

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

Details

Attachments

(1 file)

steps, apply this very broken patch:
Index: nsCSSKeywords.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/shared/src/nsCSSKeywords.cpp,v
retrieving revision 3.20
diff -u -0 -r3.20 nsCSSKeywords.cpp
--- nsCSSKeywords.cpp   2001/12/17 07:11:20     3.20
+++ nsCSSKeywords.cpp   2002/02/07 19:36:10
@@ -47 +46,0 @@
-#include "nsCSSKeywordList.h"

#7  0x28f0febe in nsCSSKeywords::AddRefTable () at /home/timeless/mozilla/content/shared/src/nsCSSKeywords.cpp:64
64              nsCAutoString temp1(kCSSRawKeywords[index]);
(gdb) l
59          if (gKeywordTable) {
60      #ifdef DEBUG
61          {
62            // let's verify the table...
63            for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) {
64              nsCAutoString temp1(kCSSRawKeywords[index]);
65              nsCAutoString temp2(kCSSRawKeywords[index]);
66              ToLowerCase(temp1);
67              NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
68              NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table");

(gdb) p index
$5 = 187
(gdb) p kCSSRawKeywords[187]
$14 = 0xa5d12e0 <Error reading address 0xa5d12e0: Bad address>

(gdb) p kCSSRawKeywords[1]
$6 = 0x0
(gdb) p kCSSRawKeywords[2]
$7 = 0x0
(gdb) p kCSSRawKeywords[3]
$8 = 0x290e3cf1 "-moz-appearance"
(gdb) p kCSSRawKeywords[4]
$9 = 0x290e3d01 "-moz-border-radius"
(gdb) p kCSSRawKeywords[5]
$10 = 0x290e3d14 "-moz-border-radius-topleft"
(gdb) p kCSSRawKeywords[6]
$11 = 0x290e3d2f "-moz-border-radius-topright"
(gdb) p kCSSRawKeywords[7]
$12 = 0x290e3d4b "-moz-border-radius-bottomleft"
(gdb) p kCSSRawKeywords[8]
$13 = 0x290e3d80 "-moz-border-radius-bottomright"
(gdb) p kCSSRawKeywords[186]
$15 = 0x0

feel free to mark invalid, otherwise if you're willing to accept a donated patch that would null check walking the array reassign to me.
confirming to get this off the unco list...
Status: UNCONFIRMED → NEW
Ever confirmed: true
ok, reassigning
Assignee: dbaron → timeless
.
Assignee: timeless → timeless
Attached patch patchSplinter Review
Attachment #133841 - Flags: superreview?(bzbarsky)
Attachment #133841 - Flags: review?(bzbarsky)
Comment on attachment 133841 [details] [diff] [review]
patch

r+sr=bzbarsky.	Looks reasonable.
Attachment #133841 - Flags: superreview?(bzbarsky)
Attachment #133841 - Flags: superreview+
Attachment #133841 - Flags: review?(bzbarsky)
Attachment #133841 - Flags: review+
checked in
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: