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

Commit7fb8801

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 parent67fc4c9 commit7fb8801

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
@@ -375,6 +375,7 @@ getNextFlagFromString(IspellDict *Conf, const char **sflagset, char *sflag)
375375
stop= (maxstep==0);
376376
break;
377377
caseFM_NUM:
378+
errno=0;
378379
s=strtol(*sflagset,&next,10);
379380
if (*sflagset==next||errno==ERANGE)
380381
ereport(ERROR,
@@ -1037,6 +1038,7 @@ setCompoundAffixFlagValue(IspellDict *Conf, CompoundAffixFlag *entry,
10371038
char*next;
10381039
inti;
10391040

1041+
errno=0;
10401042
i=strtol(s,&next,10);
10411043
if (s==next||errno==ERANGE)
10421044
ereport(ERROR,
@@ -1164,6 +1166,7 @@ getAffixFlagSet(IspellDict *Conf, char *s)
11641166
intcuraffix;
11651167
char*end;
11661168

1169+
errno=0;
11671170
curaffix=strtol(s,&end,10);
11681171
if (s==end||errno==ERANGE)
11691172
ereport(ERROR,
@@ -1740,6 +1743,7 @@ NISortDictionary(IspellDict *Conf)
17401743

17411744
if (*Conf->Spell[i]->p.flag!='\0')
17421745
{
1746+
errno=0;
17431747
curaffix=strtol(Conf->Spell[i]->p.flag,&end,10);
17441748
if (Conf->Spell[i]->p.flag==end||errno==ERANGE)
17451749
ereport(ERROR,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp