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

Commit17935e1

Browse files
Fix array subscript warnings
Commita5cf808 accidentally passed signed chars to isalpha andisspace in the parser code which leads to undefined behavior. Fixby casting the parameters to unsigned chars.Author: Pavel Stehule <pavel.stehule@gmail.com>Reported-by: Tom Lane <tgl@sss.pgh.pa.us>Reported-by: Michael Paquier <michael@paquier.xyz>Discussion:https://postgr.es/m/388186.1701315586@sss.pgh.pa.usDiscussion:https://postgr.es/m/ZWgg5xim2CXQcfmh@paquier.xyz
1 parentb589f21 commit17935e1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎src/bin/pg_dump/filter.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@ filter_get_keyword(const char **line, int *size)
185185
*size=0;
186186

187187
/* Skip initial whitespace */
188-
while (isspace(*ptr))
188+
while (isspace((unsignedchar)*ptr))
189189
ptr++;
190190

191-
if (isalpha(*ptr))
191+
if (isalpha((unsignedchar)*ptr))
192192
{
193193
result=ptr++;
194194

195-
while (isalpha(*ptr)||*ptr=='_')
195+
while (isalpha((unsignedchar)*ptr)||*ptr=='_')
196196
ptr++;
197197

198198
*size=ptr-result;
@@ -301,7 +301,7 @@ read_pattern(FilterStateData *fstate, const char *str, PQExpBuffer pattern)
301301
boolfound_space= false;
302302

303303
/* Skip initial whitespace */
304-
while (isspace(*str))
304+
while (isspace((unsignedchar)*str))
305305
str++;
306306

307307
if (*str=='\0')
@@ -312,7 +312,7 @@ read_pattern(FilterStateData *fstate, const char *str, PQExpBuffer pattern)
312312

313313
while (*str&&*str!='#')
314314
{
315-
while (*str&& !isspace(*str)&& !strchr("#,.()\"",*str))
315+
while (*str&& !isspace((unsignedchar)*str)&& !strchr("#,.()\"",*str))
316316
{
317317
/*
318318
* Append space only when it is allowed, and when it was found in
@@ -351,7 +351,7 @@ read_pattern(FilterStateData *fstate, const char *str, PQExpBuffer pattern)
351351
found_space= false;
352352

353353
/* skip ending whitespaces */
354-
while (isspace(*str))
354+
while (isspace((unsignedchar)*str))
355355
{
356356
found_space= true;
357357
str++;
@@ -400,7 +400,7 @@ filter_read_item(FilterStateData *fstate,
400400
fstate->lineno++;
401401

402402
/* Skip initial white spaces */
403-
while (isspace(*str))
403+
while (isspace((unsignedchar)*str))
404404
str++;
405405

406406
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp