tsvector filter problem

Started by Stas Kelvichover 9 years ago2 messages
#1Stas Kelvich
s.kelvich@postgrespro.ru
1 attachment(s)

Hi.

As discovered by Oleg Bartunov, current filter() function for tsvector can crash backend.
Bug was caused erroneous usage of char type in memmove argument.

Attachments:

tsvector_bugfix_type.diffapplication/octet-stream; name=tsvector_bugfix_type.diffDownload
diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c
index 8298e38..b138bf1 100644
--- a/src/backend/utils/adt/tsvector_op.c
+++ b/src/backend/utils/adt/tsvector_op.c
@@ -773,8 +773,8 @@ tsvector_filter(PG_FUNCTION_ARGS)
 	bool	   *nulls;
 	int			nweigths;
 	int			i, j;
-	char		mask = 0,
-				cur_pos = 0;
+	int			cur_pos = 0;
+	char		mask = 0;
 
 	deconstruct_array(weights, CHAROID, 1, true, 'c',
 					  &dweights, &nulls, &nweigths);
#2Teodor Sigaev
teodor@sigaev.ru
In reply to: Stas Kelvich (#1)
Re: tsvector filter problem

Thank you, pushed.

Stas Kelvich wrote:

Hi.

As discovered by Oleg Bartunov, current filter() function for tsvector can crash backend.
Bug was caused erroneous usage of char type in memmove argument.

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers