fix(data): reject partial and malformed map data
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
void
|
||||
dictionary_candidates(struct ct *t)
|
||||
{
|
||||
static char malformed[] = { 'o', 'k', ' ', (char)0x80 };
|
||||
char many[512], item[8];
|
||||
char *p;
|
||||
Dictreq req;
|
||||
@@ -53,6 +54,11 @@ dictionary_candidates(struct ct *t)
|
||||
CT_EQ_INT(t, 0, scmp(&req.pre, &res.key));
|
||||
checkstr(t, "first capped candidate", "c00", &res.kouho[0]);
|
||||
checkstr(t, "last capped candidate", "c31", &res.kouho[31]);
|
||||
key = mkstr("malformed");
|
||||
hmapset(&lang->dict, &key, malformed, sizeof malformed);
|
||||
req.key = key;
|
||||
dictlookup(&req, &res);
|
||||
CT_EQ_INT(t, 0, res.nkouho);
|
||||
cleanup:
|
||||
hmapfree(lang->dict);
|
||||
lang->dict = saved;
|
||||
|
||||
Reference in New Issue
Block a user