Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99c01aa

Browse files
committed
Clear errno before calling strtol() in spell.c.
Per POSIX, a caller of strtol() that wishes to check for errors mustset errno to 0 beforehand. Several places in spell.c neglected that,so that they risked delivering a false overflow error in case errnohad been ERANGE already. Given the lack of field reports, this casemay be unreachable at present --- but it's surely trouble waiting tohappen, so fix it.Author: Jacob Brazeal <jacob.brazeal@gmail.com>Discussion:https://postgr.es/m/CA+COZaBhsq6EromFm+knMJfzK6nTpG23zJ+K2=nfUQQXcj_xcQ@mail.gmail.comBackpatch-through: 13
1 parentc3510cf commit99c01aa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎src/backend/tsearch/spell.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ getNextFlagFromString(IspellDict *Conf, char **sflagset, char *sflag)
374374
stop= (maxstep==0);
375375
break;
376376
caseFM_NUM:
377+
errno=0;
377378
s=strtol(*sflagset,&next,10);
378379
if (*sflagset==next||errno==ERANGE)
379380
ereport(ERROR,
@@ -1036,6 +1037,7 @@ setCompoundAffixFlagValue(IspellDict *Conf, CompoundAffixFlag *entry,
10361037
char*next;
10371038
inti;
10381039

1040+
errno=0;
10391041
i=strtol(s,&next,10);
10401042
if (s==next||errno==ERANGE)
10411043
ereport(ERROR,
@@ -1163,6 +1165,7 @@ getAffixFlagSet(IspellDict *Conf, char *s)
11631165
intcuraffix;
11641166
char*end;
11651167

1168+
errno=0;
11661169
curaffix=strtol(s,&end,10);
11671170
if (s==end||errno==ERANGE)
11681171
ereport(ERROR,
@@ -1735,6 +1738,7 @@ NISortDictionary(IspellDict *Conf)
17351738

17361739
if (*Conf->Spell[i]->p.flag!='\0')
17371740
{
1741+
errno=0;
17381742
curaffix=strtol(Conf->Spell[i]->p.flag,&end,10);
17391743
if (Conf->Spell[i]->p.flag==end||errno==ERANGE)
17401744
ereport(ERROR,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp