Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Sema: Warn on sizeof on binary ops on decayed arrays. | Benjamin Kramer | 2013-03-29 | 1 | -0/+18 |
The array will decay into a pointer, creating an unexpected result. sizeof(array + int) is an easy to make typo for sizeof(array) + int. This was motivated by a NetBSD security bug, used sizeof(key - r) instead of sizeof(key) - r, reducing entropy in a random number generator. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/subr_cprng.c.diff?r1=1.14&r2=1.15&only_with_tag=MAIN&f=h Differential Revision: http://llvm-reviews.chandlerc.com/D571 llvm-svn: 178371 |