coreutils
[Top][All Lists]
Advanced

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

Re: -fsanitize=undefined errors


From: Pádraig Brady
Subject: Re: -fsanitize=undefined errors
Date: Wed, 03 Dec 2014 21:20:00 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 03/12/14 18:18, Eric Blake wrote:
> [adding the public list]
> 
> On 12/03/2014 10:49 AM, Dingbao Xie wrote:
>> Dear coreutils maintainer,
>> I'm a visiting phd student at UC davis and currently works
>> on a project aiming to detect undefined behaviors.
>> clang has a sanitizer called ubsan which can identify certain
>> undefined behaviors at runtime. I tried to do experiment on coreutils
>> and found a shift out of bounds in a c file.
>> Below is the detail information:
>>
>> xdb@xie:$ ./arch _<<<\x00
>> ../../lib/quotearg.c:554:45: runtime error: left shift of 1 by 31 places
>> cannot be represented in type 'int'
>> ./arch: extra operand `_'
>> Try `./arch --help' for more information
>>
>>
>> Could you please confirm that whether it is a serious problem or not?
>> BTW, I built coreutil-6.11 with clang (-fsanitize=undefined).
> 
> Thanks for the report.  This issue has already been fixed upstream;
> http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=831b84, and is
> already in newer versions of coreutils.  You would be much better off
> doing your testing on the latest coreutils.git instead of old versions.

On a related note I just noticed a false positive -fsanitize=undefined
failure with gcc 4.9.2 which the attached should avoid.
An alternative to the attached approach might be to avoid unaligned
accesses altogether by getting readisaac() to memcpy only unaligned slop?

cheers,
Pádraig.

Attachment: isaac-fsanitize-undefined.patch
Description: Text Data


reply via email to

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