Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9fe09757
Commit
9fe09757
authored
21 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Avoid generating invalid character encoding sequences in make_greater_string.
Not sure how this mistake evaded detection for so long.
parent
b8362d46
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/utils/adt/selfuncs.c
+14
-2
14 additions, 2 deletions
src/backend/utils/adt/selfuncs.c
with
14 additions
and
2 deletions
src/backend/utils/adt/selfuncs.c
+
14
−
2
View file @
9fe09757
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.15
5
2004/0
1/17 20:09:35
tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.15
6
2004/0
2/02 03:07:08
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -3742,6 +3742,11 @@ pattern_selectivity(Const *patt, Pattern_Type ptype)
...
@@ -3742,6 +3742,11 @@ pattern_selectivity(Const *patt, Pattern_Type ptype)
*
*
* This could be rather slow in the worst case, but in most cases we
* This could be rather slow in the worst case, but in most cases we
* won't have to try more than one or two strings before succeeding.
* won't have to try more than one or two strings before succeeding.
*
* NOTE: at present this assumes we are in the C locale, so that simple
* bytewise comparison applies. However, we might be in a multibyte
* encoding such as UTF-8, so we do have to watch out for generating
* invalid encoding sequences.
*/
*/
Const
*
Const
*
make_greater_string
(
const
Const
*
str_const
)
make_greater_string
(
const
Const
*
str_const
)
...
@@ -3788,13 +3793,20 @@ make_greater_string(const Const *str_const)
...
@@ -3788,13 +3793,20 @@ make_greater_string(const Const *str_const)
/*
/*
* Try to generate a larger string by incrementing the last byte.
* Try to generate a larger string by incrementing the last byte.
*/
*/
if
(
*
lastchar
<
(
unsigned
char
)
255
)
while
(
*
lastchar
<
(
unsigned
char
)
255
)
{
{
Const
*
workstr_const
;
Const
*
workstr_const
;
(
*
lastchar
)
++
;
(
*
lastchar
)
++
;
if
(
datatype
!=
BYTEAOID
)
if
(
datatype
!=
BYTEAOID
)
{
/* do not generate invalid encoding sequences */
if
(
!
pg_verifymbstr
((
const
unsigned
char
*
)
workstr
,
len
,
true
))
continue
;
workstr_const
=
string_to_const
(
workstr
,
datatype
);
workstr_const
=
string_to_const
(
workstr
,
datatype
);
}
else
else
workstr_const
=
string_to_bytea_const
(
workstr
,
len
);
workstr_const
=
string_to_bytea_const
(
workstr
,
len
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment