mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
json: Correctly handle bad strings with missing closing quotes
Also add a test for this case. Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
This commit is contained in:
parent
c692ec3afd
commit
708b4aac91
2 changed files with 14 additions and 1 deletions
|
|
@ -216,6 +216,18 @@ START_TEST(array_test) {
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(bad_test) {
|
||||
unsigned int i;
|
||||
const char *bad_parse[] = {
|
||||
"\"" /* Quote not closed */,
|
||||
};
|
||||
|
||||
for (i = 0; i < PA_ELEMENTSOF(bad_parse); i++) {
|
||||
fail_unless(pa_json_parse(bad_parse[i]) == NULL);
|
||||
}
|
||||
}
|
||||
END_TEST
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int failed = 0;
|
||||
Suite *s;
|
||||
|
|
@ -231,6 +243,7 @@ int main(int argc, char *argv[]) {
|
|||
tcase_add_test(tc, bool_test);
|
||||
tcase_add_test(tc, object_test);
|
||||
tcase_add_test(tc, array_test);
|
||||
tcase_add_test(tc, bad_test);
|
||||
suite_add_tcase(s, tc);
|
||||
|
||||
sr = srunner_create(s);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue