aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-08-03 01:50:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-08-03 01:50:27 +0000
commit532a4c3531d65fef101d2564234f064883ea92ef (patch)
tree0daec981293802ac05efe7fa7b0e3bbe0c84682e /src
parent57641a165ffa7ef33c21c321a59104db7985df74 (diff)
downloadpostgresql-532a4c3531d65fef101d2564234f064883ea92ef.tar.gz
postgresql-532a4c3531d65fef101d2564234f064883ea92ef.zip
Be a little more careful with the shift computations in QT2QTN and
makeTSQuerySign. The first of these is a live bug, on some platforms, as per bug #5590 from John Regehr. However the consequences seem limited because of the relatively narrow scope of use of QTNode.sign. The shift in makeTSQuerySign is actually safe because TSQS_SIGLEN is unsigned, but it seems like a good idea to insert an explicit cast rather than depend on that.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/tsquery_op.c4
-rw-r--r--src/backend/utils/adt/tsquery_util.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/tsquery_op.c b/src/backend/utils/adt/tsquery_op.c
index 0b81ff59385..03edc7b172f 100644
--- a/src/backend/utils/adt/tsquery_op.c
+++ b/src/backend/utils/adt/tsquery_op.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.9 2010/08/03 00:10:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_op.c,v 1.10 2010/08/03 01:50:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -209,7 +209,7 @@ makeTSQuerySign(TSQuery a)
for (i = 0; i < a->size; i++)
{
if (ptr->type == QI_VAL)
- sign |= ((TSQuerySign) 1) << (ptr->qoperand.valcrc % TSQS_SIGLEN);
+ sign |= ((TSQuerySign) 1) << (((unsigned int) ptr->qoperand.valcrc) % TSQS_SIGLEN);
ptr++;
}
diff --git a/src/backend/utils/adt/tsquery_util.c b/src/backend/utils/adt/tsquery_util.c
index 5e309fea7cd..80e169e4307 100644
--- a/src/backend/utils/adt/tsquery_util.c
+++ b/src/backend/utils/adt/tsquery_util.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_util.c,v 1.14 2010/08/03 00:10:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/tsquery_util.c,v 1.15 2010/08/03 01:50:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ QT2QTN(QueryItem *in, char *operand)
else if (operand)
{
node->word = operand + in->qoperand.distance;
- node->sign = 1 << (in->qoperand.valcrc % 32);
+ node->sign = ((uint32) 1) << (((unsigned int) in->qoperand.valcrc) % 32);
}
return node;