Closed Bug 480655 Opened 11 years ago Closed 11 years ago

ATTRCHILD_ARRAY_MAX_CHILD_COUNT is more than mAttrAndChildCount can hold on 64-bit platforms

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
All
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: mats, Assigned: mats)

References

Details

(Keywords: 64bit)

Attachments

(1 file)

Attached patch Patch rev. 1Splinter Review
Compiling content/base/src/nsAttrAndChildArray.cpp with gcc 4.2.4
on x86_64 Linux:

content/base/src/nsAttrAndChildArray.cpp: In member function 'nsresult nsAttrAndChildArray::InsertChildAt(nsIContent*, PRUint32)':
content/base/src/nsAttrAndChildArray.cpp:169: warning: comparison is always true due to limited range of data type

http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsAttrAndChildArray.cpp#160

In nsAttrAndChildArray.h:
#define ATTRCHILD_ARRAY_MAX_CHILD_COUNT \
    (~PtrBits(0) >> ATTRCHILD_ARRAY_ATTR_SLOTS_BITS)

and in content/base/src/nsAttrValue.h:
typedef unsigned long PtrBits;

so gcc is right, ATTRCHILD_ARRAY_MAX_CHILD_COUNT will always be >
the max value of a PRUint32.

In nsAttrAndChildArray.h, the member holding the bits is defined as:
    PRUint32 mAttrAndChildCount;
Attachment #364599 - Flags: superreview?(jonas)
Attachment #364599 - Flags: review?(jonas)
Comment on attachment 364599 [details] [diff] [review]
Patch rev. 1

Thanks!
Attachment #364599 - Flags: superreview?(jonas)
Attachment #364599 - Flags: superreview+
Attachment #364599 - Flags: review?(jonas)
Attachment #364599 - Flags: review+
http://hg.mozilla.org/mozilla-central/rev/5cb7c5a0aaf8

-> FIXED
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Component: Content → DOM
QA Contact: content → general
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.