mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 12:20:56 +00:00
Bug 1348797 - Add null-check to validTagChars test in LocaleService::NegotiateLanguages. r=jfkthame
--HG-- extra : amend_source : f6dde0867a6cf10b5b2f50c3cfcf3f383d708d28
This commit is contained in:
parent
ebd9e78f82
commit
b17d737c5b
@ -463,7 +463,7 @@ LocaleService::NegotiateLanguages(const char** aRequested,
|
|||||||
// Check that the given string contains only ASCII characters valid in tags
|
// Check that the given string contains only ASCII characters valid in tags
|
||||||
// (i.e. alphanumerics, plus '-' and '_'), and is non-empty.
|
// (i.e. alphanumerics, plus '-' and '_'), and is non-empty.
|
||||||
auto validTagChars = [](const char* s) {
|
auto validTagChars = [](const char* s) {
|
||||||
if (!*s) {
|
if (!s || !*s) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
while (*s) {
|
while (*s) {
|
||||||
|
@ -86,6 +86,11 @@ const data = {
|
|||||||
],
|
],
|
||||||
"should not crash on invalid input": [
|
"should not crash on invalid input": [
|
||||||
[null, ["fr-FR"], []],
|
[null, ["fr-FR"], []],
|
||||||
|
[[null], [], []],
|
||||||
|
[[undefined], [], []],
|
||||||
|
[[undefined], [null], []],
|
||||||
|
[[undefined], [undefined], []],
|
||||||
|
[[null], [null], null, null, []],
|
||||||
[undefined, ["fr-FR"], []],
|
[undefined, ["fr-FR"], []],
|
||||||
[2, ["fr-FR"], []],
|
[2, ["fr-FR"], []],
|
||||||
["fr-FR", ["fr-FR"], []],
|
["fr-FR", ["fr-FR"], []],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user