Bug 1348797 - Add null-check to validTagChars test in LocaleService::NegotiateLanguages. r=jfkthame

--HG--
extra : amend_source : f6dde0867a6cf10b5b2f50c3cfcf3f383d708d28
This commit is contained in:
Zibi Braniecki 2017-03-20 15:14:58 -04:00
Родитель ebd9e78f82
Коммит b17d737c5b
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -463,7 +463,7 @@ LocaleService::NegotiateLanguages(const char** aRequested,
// Check that the given string contains only ASCII characters valid in tags
// (i.e. alphanumerics, plus '-' and '_'), and is non-empty.
auto validTagChars = [](const char* s) {
if (!*s) {
if (!s || !*s) {
return false;
}
while (*s) {

Просмотреть файл

@ -86,6 +86,11 @@ const data = {
],
"should not crash on invalid input": [
[null, ["fr-FR"], []],
[[null], [], []],
[[undefined], [], []],
[[undefined], [null], []],
[[undefined], [undefined], []],
[[null], [null], null, null, []],
[undefined, ["fr-FR"], []],
[2, ["fr-FR"], []],
["fr-FR", ["fr-FR"], []],