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
parent ebd9e78f82
commit b17d737c5b
2 changed files with 6 additions and 1 deletions

View File

@ -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) {

View File

@ -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"], []],