This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/61035] New: Crash in getcwd intrinsic due to stack overflow


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61035

            Bug ID: 61035
           Summary: Crash in getcwd intrinsic due to stack overflow
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jb at gcc dot gnu.org

The example program below crashes (my stack size limit is 8 MiB).

program getcwd_overflow
  implicit none
  character(len=10485760) :: str ! 10 MiB
  call getcwd(str)
  print *, trim(str)
end program getcwd_overflow

The reason is that in libgfortran/intrinsics/getcwd.c we try to allocate space
for a NULL-terminated duplicate of the string on the stack.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]