ChakraCore icon indicating copy to clipboard operation
ChakraCore copied to clipboard

ASSERTION Failure "U_BUFFER_OVERFLOW_ERROR" in ChakraCore/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp, line 941

Open 1789120321 opened this issue 3 years ago • 1 comments

commit : 41ad58a
Engine version : ch version 1.13.0.0-beta
Build platform : Ubuntu 18.04
Clang version : 6.0.0
Build steps : ./build.sh --sanitize=address --static -j -d

POC

cat b66bf88394d84085b34f1ca313f087e2.js
-----------------------------------------------------------------
// |reftest| skip-if(!this.hasOwnProperty("Intl"))

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Check for duplicate variants and singletons case-insensitively, but don't
// check in privateuse components.
function checkInvalidLocale(locale) {
  try {
    new Intl.NumberFormat(locale);
    throw new Error("didn't throw");
  } catch (e) {
    e instanceof RangeError;
    true;
    "expected RangeError for locale '" + locale + "', got " + e;
  }
}

var badLocales = ["en-u-foo-U-foo", "en-tester-Tester", "en-tesTER-TESter", "de-DE-u-kn-true-U-kn-true", "ar-u-foo-q-bar-u-baz", "ar-z-moo-u-foo-q-bar-z-eit-u-baz"];

for (var locale of badLocales) {
  checkInvalidLocale(locale);
} // Fully-privateuse locales are okay.


for (var locale of badLocales) {
  new Intl.NumberFormat("x-" + locale).format(5);
} // Locales with trailing privateuse also okay.


for (var locale of badLocales) {
  new Intl.NumberFormat("en-x-" + locale).format(5);
  badLocales.reduce(function () {
    checkInvalidLocale(locale);
    locale += locale + locale;
  });
  new Intl.NumberFormat("en-u-foo-x-u-" + locale).format(5);
}

if (typeof reportCompare === "function") {
  reportCompare(true, true);
}

Assert Log

./ch b66bf88394d84085b34f1ca313f087e2.js
ASSERTION 3914: (ChakraCore-master/lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp, line 941) U_BUFFER_OVERFLOW_ERROR
 Failure: (false)
Illegal instruction

Hi, Richard, could you please help check this issue?

@rhuanjl

1789120321 avatar Mar 12 '22 15:03 1789120321

Can confirm that it throws the error in question, also the release mode crashes. Probably should fail gracefully.

ppenzin avatar Mar 26 '22 00:03 ppenzin