This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] time: Use struct alloc_buffer in __tzfile_read


* Paul Eggert:

> Florian Weimer wrote:
>> +  if (alloc_buffer_alloc_array (&buf, __time64_t, num_transitions)
>> +      != transitions)
>> +    /* Either the start of the allocation moved unexpectedly
>> +       (misaligned heap pointer, should not happen), or we had an
>> +       overflow.  */
>> +    goto lose;
>
> Is this comparison needed? The overflow will be caught later anyway,
> and the != comparison cannot fail.
>
> Otherwise it looks good; thanks.

Okay, I will remove that.  Even if the allocation moves the pointer
(after removal of the alignment code), we will not cause heap corruption
because the deallocation will use the original (non-moved) pointer.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]