[Bug c/30622] New: char *p; p = "str"; puts "str" into rodata
vda dot linux at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jan 28 16:04:00 GMT 2007
char p;
int main() {
p = "str";
return 0;
}
If anyone will try to assign something to p[0] and if rodata is write
protected,
we'll segfault. Assembly:
.file "t.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "str"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
movl $.LC0, %eax
movb %al, p
xorl %eax, %eax
leave
ret
.size main, .-main
.comm p,1,1
.ident "GCC: (GNU) 4.1.1"
.section .note.GNU-stack,"",@progbits
--
Summary: char *p; p = "str"; puts "str" into rodata
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vda dot linux at googlemail dot com
GCC build triplet: i386-pc-linux-gnu
GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30622
More information about the Gcc-bugs
mailing list