Check for an empty string before dereferencing the first character of the string. No bug, rs=till

--HG--
extra : rebase_source : e4b408f772aa2460db920871086faa37c04356bb
This commit is contained in:
Jeff Walden 2013-12-09 15:07:31 -08:00
parent 4ff31eefe1
commit 71e5708f15

View File

@ -223,7 +223,7 @@ IdToTypeId(jsid id)
if (JSID_IS_STRING(id)) {
JSFlatString *str = JSID_TO_FLAT_STRING(id);
JS::TwoByteChars cp = str->range();
if (JS7_ISDEC(cp[0]) || cp[0] == '-') {
if (cp.length() > 0 && (JS7_ISDEC(cp[0]) || cp[0] == '-')) {
for (size_t i = 1; i < cp.length(); ++i) {
if (!JS7_ISDEC(cp[i]))
return id;