This is the mail archive of the
mailing list for the GCC project.
[Bug libfortran/25142] New: Segfault in unformatted_write for large records
- From: "iwan at irs dot phy dot nrc dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Nov 2005 17:43:44 -0000
- Subject: [Bug libfortran/25142] New: Segfault in unformatted_write for large records
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I get a segmentation fault when trying to execute the
following simple program:
s(i:i) = 'a'
I think, the problem can be traced back to mmap_alloc(),
where the size of the allocated memory is calculated as
length = ((where - offset) & page_mask) + 2 * page_size;
and turns out to be 8192 bytes on my system, with no checks
being made to see if this is large enough for the actual
data size. The subsequent memcpy in unformatted_write leads
to segmentation fault.
The fix is trivial (allocate enough memroy in mmap_alloc),
unless there are considerations concerning the maximum
memory use of the runtime library.
Summary: Segfault in unformatted_write for large records
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: iwan at irs dot phy dot nrc dot ca
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu