errmsg("invalid affix alias \"%s\"", s)));
if (curaffix > 0 && curaffix < Conf->nAffixData)
+ {
+ if (Conf->AffixData[curaffix] == NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("invalid affix alias \"%s\"", s)));
/*
* Do not subtract 1 from curaffix because empty string was added
* in NIImportOOAffixes
*/
return Conf->AffixData[curaffix];
+ }
else if (curaffix > Conf->nAffixData)
ereport(ERROR,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
tsearch_readline_end(&trst);
if (ptype)
pfree(ptype);
+
+ /* Reject incomplete AF alias table. */
+ if (Conf->useFlagAliases && curaffix != naffix)
+ ereport(ERROR,
+ (errcode(ERRCODE_CONFIG_FILE_ERROR),
+ errmsg("number of aliases is less than specified number %d",
+ naffix - 1)));
}
/*
bool oldformat = false;
char *recoded = NULL;
+ flag[0] = '\0'; /* no flag seen yet */
+
if (!tsearch_readline_begin(&trst, filename))
ereport(ERROR,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
/* Store compound affixes in the Conf->CompoundAffix array */
if (Conf->naffixes > 1)
qsort(Conf->Affix, Conf->naffixes, sizeof(AFFIX), cmpaffix);
- Conf->CompoundAffix = ptr = palloc_array(CMPDAffix, Conf->naffixes);
+ /* +1 for terminator */
+ Conf->CompoundAffix = ptr = palloc_array(CMPDAffix, Conf->naffixes + 1);
ptr->affix = NULL;
for (int i = 0; i < Conf->naffixes; i++)