Re: BUG #5590: undefined shift behavior

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5590: undefined shift behavior
Дата
Msg-id 16806.1280761578@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #5590: undefined shift behavior  ("John Regehr" <regehr@cs.utah.edu>)
Ответы Re: BUG #5590: undefined shift behavior  (John Regehr <regehr@cs.utah.edu>)
Re: BUG #5590: undefined shift behavior  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
"John Regehr" <regehr@cs.utah.edu> writes:
> Bug reference:      5590
> Logged by:          John Regehr
> Email address:      regehr@cs.utah.edu
> PostgreSQL version: head 8/2/10
> Operating system:   OSX
> Description:        undefined shift behavior
> Details:

> During a "make check" the left-shift operator at tsquery_util.c 48:18 is
> passed a negative right-hand argument a number of times.

Hmm.  valcrc is declared as signed int32, so depending on what your
compiler thinks the semantics of % is, this clearly can potentially
happen.  I notice the same problem in makeTSQuerySign() in tsquery_op.c.

The fix is presumably to cast the valcrc value to unsigned int before
executing %.  However, I'm a bit worried about whether this could change
the results, and if it did whether that would invalidate any on-disk
data structures.  Oleg, Teodor, do either TSQuerySign or QTNode.sign
ever get to disk?

John: how did you detect this?

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Divyaprakash"
Дата:
Сообщение: BUG #5591: Creating and using databases
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: BUG #5591: Creating and using databases