Re: Foreign memory context read

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Foreign memory context read
Дата
Msg-id 12184.1306159104@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Foreign memory context read  (Vaibhav Kaushal <vaibhavkaushal123@gmail.com>)
Ответы Re: Foreign memory context read
Re: Foreign memory context read
Список pgsql-hackers
Vaibhav Kaushal <vaibhavkaushal123@gmail.com> writes:
> My mind started wandering after that error. Now, actually, i was trying to
> do something like this:

> *last_result = palloc0(sizeof(Datum));
> bool *isnnuull = true;
> *last_result = slot_getattr(slot, num_atts, *isnnuull);

This seems utterly confused about data types.  The first line thinks
that last_result is of type Datum ** (ie, pointer to pointer to Datum),
since it's storing a pointer-to-Datum through it.  The third line
however is treating last_result as of type Datum *, since it's storing
a Datum (not pointer to Datum) through it.  And the second line is
assigning "true" (a bool value) to a variable declared as pointer to
bool, which you then proceed to incorrectly dereference while passing it
as the last argument to slot_getattr.  The code will certainly crash on
that deref, independently of the multiple other bugs here.

Recommendation: gcc is your friend.  Pay attention to the warnings it
gives you.
        regards, tom lane


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Isolation checks under MSVC
Следующее
От: Aidan Van Dyk
Дата:
Сообщение: Re: SSI predicate locking on heap -- tuple or row?