Re: ARRNELEMS Out-of-bounds possible errors

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: ARRNELEMS Out-of-bounds possible errors
Дата
Msg-id CAEudQArkLAqnX0QiJiqtd5uHwaeUwcm8TVqSMRvNzMwqeKrDrw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ARRNELEMS Out-of-bounds possible errors  (Nikita Malakhov <hukutoc@gmail.com>)
Ответы Re: ARRNELEMS Out-of-bounds possible errors  (Nikita Malakhov <hukutoc@gmail.com>)
Список pgsql-hackers
Em qui., 22 de dez. de 2022 às 15:45, Nikita Malakhov <hukutoc@gmail.com> escreveu:
Hi,

Actually, there would be much more sources affected, like
         nbytes += subbytes[outer_nelems];
         subnitems[outer_nelems] = ArrayGetNItems(this_ndims,
                                        ARR_DIMS(array));
         nitems += subnitems[outer_nelems];
         havenulls |= ARR_HASNULL(array);
         outer_nelems++;
      }

Maybe it is better for most calls like this to keep old behavior, by passing a flag
that says which behavior is expected by caller?
I agreed that it is better to keep old behavior.
Even the value 0 is problematic, with calls like this:

nel = ARRNELEMS(ent);
memcpy(ptr, ARRPTR(ent), nel * sizeof(int32));

regards,
Ranier Vilela

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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Array initialisation notation in syscache.c
Следующее
От: David Rowley
Дата:
Сообщение: Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options