[LLVMbugs] [Bug 20473] AddressSanitizer reports false positive global-buffer-overflow.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 28 08:07:47 PDT 2014


piotr.szeplik at nsn.com changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #3 from piotr.szeplik at nsn.com ---
(In reply to comment #2)
> Isn't this an actual bug in the code that asan correctly reports? 
> You are initializing a char array of 3 elements with "",
> which is a char array with 2 elements.

This is correct. It is guaranteed by the standard (section 8.5.2
[dcl.init.string] paragraph number 3) where you can read:
"If there are fewer initializers than there are array elements, each element
not explicitly initialized shall be zero-initialized."

Please also notice that the issue disappear if you change a layout of the
structure like below:

struct test
    char b[3];
    char a[2];

> (Please reopen the bug if you disagree)


Best regards,

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140728/9cfa3779/attachment.html>

More information about the llvm-bugs mailing list