This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/18063] New: Gcc doesn't check overflowed size of structure
- From: "mikulas at artax dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Oct 2004 17:20:42 -0000
- Subject: [Bug c/18063] New: Gcc doesn't check overflowed size of structure
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code compiles and runs, but shouldn't, because the size of
structure a overflows size_t type. Overflowed size is checked for arrays, for
global and local variables, but not for structures.
struct a {
char x[0x7fffffff];
char b[0x7fffffff];
char c[3];
};
main()
{
struct a *b = malloc(sizeof(struct a));
return sizeof (struct a);
}
--
Summary: Gcc doesn't check overflowed size of structure
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18063