bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash-4.3 bug report


From: Eric Blake
Subject: Re: bash-4.3 bug report
Date: Mon, 14 Apr 2014 09:33:59 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/14/2014 09:26 AM, Andreas Schwab wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> It silences static code checkers and avoids undefined C behavior.
>>
>> Also, if invokers[] is allocated such that it ends on the end of a page
>> boundary (such as might be the case under certain malloc debuggers),
>> then doing the bounds check first will avoid an out-of-bounds access
>> causing a SEGFAULT.
> 
> invokers[] is guaranteed to end with a NULL element, so there cannot be
> any out-of-bounds access, and the use is completely defined.  The NULL
> check is the primary condition, with the index check only being
> secondary.

In that case, the index check is dead code, and it could be elided as a
micro-optimization.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]