Limit JSString length to 28 bits on 64-bit platforms (bug 513348, r=brendan).

This commit is contained in:
David Anderson 2009-09-21 17:17:19 -07:00
parent 0d45861f13
commit 647db183ee
2 changed files with 7 additions and 0 deletions

View File

@ -78,6 +78,9 @@
#define JSSTRDEP_RECURSION_LIMIT 100
JS_STATIC_ASSERT(size_t(JSString::MAX_LENGTH) <= size_t(JSVAL_INT_MAX));
JS_STATIC_ASSERT(INT_FITS_IN_JSVAL(JSString::MAX_LENGTH));
static JS_ALWAYS_INLINE JSBool
UWordInRootedValue(JSContext *cx, size_t i, jsval *vp)
{

View File

@ -142,7 +142,11 @@ struct JSString {
ATOMIZED = JSSTRING_BIT(JS_BITS_PER_WORD - 3),
DEFLATED = JSSTRING_BIT(JS_BITS_PER_WORD - 4),
#if JS_BITS_PER_WORD > 32
LENGTH_BITS = 28,
#else
LENGTH_BITS = JS_BITS_PER_WORD - 4,
#endif
LENGTH_MASK = JSSTRING_BITMASK(LENGTH_BITS),
/*