[Pgbigm-hackers] Checks for buffer overflow and update copyright information

Back to archive index

Fujii Masao masao****@gmail*****
2014年 5月 22日 (木) 03:30:07 JST


On Wed, May 21, 2014 at 9:38 PM, Beena Emerson <memis****@gmail*****> wrote:
> On Wed, May 21, 2014 at 8:35 AM, Fujii Masao
>>
>> So the check of "(Size) slen >= (MaxAllocSize /
>> pg_database_encoding_max_length()))"
>> is not required?
>>
>
> No.

Does "No" mean that you think this check is necessary?

>> Regarding the check of "(Size) (slen / 2) >= (MaxAllocSize /
>> (sizeof(bigm) * 3))",
>> could you convince me why this check is required? After this check, the
>> memory
>> is allocated as follows. The check is to prevent the part
>> "sizeof(bigm) * (slen / 2 + 1) * 3"
>> from overflowing the maximum size of integer?
>>
>>     (BIGM *) palloc(VARHDRSZ + sizeof(bigm) * (slen / 2 + 1) *3);
>
>
> Yes.

ISTM that the attached patch is better. Thought?

Regards,

-- 
Fujii Masao
-------------- next part --------------
$B%F%-%9%H7A<00J30$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
$B%U%!%$%kL>(B: buffer_overflow_check_v2.patch
$B7?(B:         text/x-diff
$B%5%$%:(B:     1377 $B%P%$%H(B
$B @ bL@(B:       $BL5$7(B
Download 



Pgbigm-hackers メーリングリストの案内
Back to archive index