Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
53 Views

OPEN statement crash on long path

Dear all,

when trying to OPEN an existing file with "status=new" from a long absolute path, the open-statement crashes in ifort 16.0.4 (observed with path-length 208 characters or more) or 17.0.4 (216 characters or more), while I did not observe a crash with ifort 15.0.3 and gfortran 4.8.5. Tested on OpenSUSE 42.2 and Ubuntu 14.0.4. The crash can be avoided when either iostat or iomsg is not provided.

program p
	implicit none
	integer :: unit, iostat
	character(500) :: iomsg
	
	open( &
		newunit=unit, &
		status='new', &
		file='file', &
		iostat=iostat, &
		iomsg=iomsg &
		)

	print *, iomsg

	close(unit)
end program

Expected output:

"cannot overwrite existing file, unit -129, file [...]".

Output on crash:

(I abbreviated the long path with [PATHNAME]:)

*** buffer overflow detected ***: ./a.out terminated
======= Backtrace: =========
/lib64/libc.so.6(+0x721af)[0x2ace8308d1af]
/lib64/libc.so.6(__fortify_fail+0x37)[0x2ace83114dc7]
/lib64/libc.so.6(+0xf8050)[0x2ace83113050]
/lib64/libc.so.6(+0xf75a9)[0x2ace831125a9]
/lib64/libc.so.6(_IO_default_xsputn+0x89)[0x2ace83090729]
/lib64/libc.so.6(_IO_vfprintf+0x1b33)[0x2ace830647e3]
/lib64/libc.so.6(__vsprintf_chk+0x88)[0x2ace83112638]
./a.out[0x4062f5]
./a.out[0x4051f9]
./a.out[0x411632]
./a.out[0x402794]
./a.out[0x4026de]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x2ace8303b6e5]
./a.out[0x4025e9]
======= Memory map: ========
00400000-004b0000 r-xp 00000000 00:2e 97121                              [PATHNAME]/a.out
006af000-006b0000 r--p 000af000 00:2e 97121                              [PATHNAME]/a.out
006b0000-006b3000 rw-p 000b0000 00:2e 97121                              [PATHNAME]/a.out
006b3000-006d1000 rw-p 00000000 00:00 0 
0211a000-0213b000 rw-p 00000000 00:00 0                                  [heap]
2ace826da000-2ace826fb000 r-xp 00000000 09:01 525333                     /lib64/ld-2.22.so
2ace826fb000-2ace826fd000 rw-p 00000000 00:00 0 
2ace82730000-2ace82734000 rw-p 00000000 00:00 0 
2ace828fa000-2ace828fb000 r--p 00020000 09:01 525333                     /lib64/ld-2.22.so
2ace828fb000-2ace828fc000 rw-p 00021000 09:01 525333                     /lib64/ld-2.22.so
2ace828fc000-2ace828fd000 rw-p 00000000 00:00 0 
2ace828fd000-2ace829f9000 r-xp 00000000 09:01 579040                     /lib64/libm-2.22.so
2ace829f9000-2ace82bf8000 ---p 000fc000 09:01 579040                     /lib64/libm-2.22.so
2ace82bf8000-2ace82bf9000 r--p 000fb000 09:01 579040                     /lib64/libm-2.22.so
2ace82bf9000-2ace82bfa000 rw-p 000fc000 09:01 579040                     /lib64/libm-2.22.so
2ace82bfa000-2ace82c12000 r-xp 00000000 09:01 525357                     /lib64/libpthread-2.22.so
2ace82c12000-2ace82e11000 ---p 00018000 09:01 525357                     /lib64/libpthread-2.22.so
2ace82e11000-2ace82e12000 r--p 00017000 09:01 525357                     /lib64/libpthread-2.22.so
2ace82e12000-2ace82e13000 rw-p 00018000 09:01 525357                     /lib64/libpthread-2.22.so
2ace82e13000-2ace82e17000 rw-p 00000000 00:00 0 
2ace82e17000-2ace82e19000 r-xp 00000000 09:01 579038                     /lib64/libdl-2.22.so
2ace82e19000-2ace83019000 ---p 00002000 09:01 579038                     /lib64/libdl-2.22.so
2ace83019000-2ace8301a000 r--p 00002000 09:01 579038                     /lib64/libdl-2.22.so
2ace8301a000-2ace8301b000 rw-p 00003000 09:01 579038                     /lib64/libdl-2.22.so
2ace8301b000-2ace831b4000 r-xp 00000000 09:01 579034                     /lib64/libc-2.22.so
2ace831b4000-2ace833b4000 ---p 00199000 09:01 579034                     /lib64/libc-2.22.so
2ace833b4000-2ace833b8000 r--p 00199000 09:01 579034                     /lib64/libc-2.22.so
2ace833b8000-2ace833ba000 rw-p 0019d000 09:01 579034                     /lib64/libc-2.22.so
2ace833ba000-2ace833be000 rw-p 00000000 00:00 0 
2ace833be000-2ace833d4000 r-xp 00000000 09:01 525376                     /lib64/libgcc_s.so.1
2ace833d4000-2ace835d3000 ---p 00016000 09:01 525376                     /lib64/libgcc_s.so.1
2ace835d3000-2ace835d4000 r--p 00015000 09:01 525376                     /lib64/libgcc_s.so.1
2ace835d4000-2ace835d5000 rw-p 00016000 09:01 525376                     /lib64/libgcc_s.so.1
7ffe53db0000-7ffe53dd2000 rw-p 00000000 00:00 0                          [stack]
7ffe53de4000-7ffe53de7000 r--p 00000000 00:00 0                          [vvar]
7ffe53de7000-7ffe53de9000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
forrtl: error (76): Abort trap signal
Image              PC                Routine            Line        Source             
a.out              00000000004767ED  Unknown               Unknown  Unknown
a.out              0000000000474687  Unknown               Unknown  Unknown
a.out              00000000004312D4  Unknown               Unknown  Unknown
a.out              00000000004310E6  Unknown               Unknown  Unknown
a.out              0000000000405F76  Unknown               Unknown  Unknown
a.out              0000000000409B68  Unknown               Unknown  Unknown
Unknown            00002ACE82C0AB10  Unknown               Unknown  Unknown
libc.so.6          00002ACE8304F8D7  Unknown               Unknown  Unknown
libc.so.6          00002ACE83050CAA  Unknown               Unknown  Unknown
Unknown            00002ACE8308D1B4  Unknown               Unknown  Unknown
libc.so.6          00002ACE83114DC7  Unknown               Unknown  Unknown
Unknown            00002ACE83113050  Unknown               Unknown  Unknown
Unknown            00002ACE831125A9  Unknown               Unknown  Unknown
libc.so.6          00002ACE83090729  Unknown               Unknown  Unknown
libc.so.6          00002ACE830647E3  Unknown               Unknown  Unknown
libc.so.6          00002ACE83112638  Unknown               Unknown  Unknown
a.out              00000000004062F5  Unknown               Unknown  Unknown
a.out              00000000004051F9  Unknown               Unknown  Unknown
a.out              0000000000411632  Unknown               Unknown  Unknown
a.out              0000000000402794  MAIN__                      6  test11.f90
a.out              00000000004026DE  Unknown               Unknown  Unknown
libc.so.6          00002ACE8303B6E5  Unknown               Unknown  Unknown
a.out              00000000004025E9  Unknown               Unknown  Unknown

I am not sure if this is a compiler bug or a problem with my local environment. If this can be confirmed as a bug, I might try to submit a report to Intel.

Best regards
Ferdinand

0 Kudos
2 Replies
Highlighted
New Contributor II
53 Views

Update: The crash seems to occur more generally in any situation in which an open-statement on a long filename runs into a (recoverable) error that is reported via iomsg.

0 Kudos
Highlighted
Valued Contributor III
53 Views

@Ferdinand T.,

Intel now expects you to submit an incident on all their product-related issues at their Online Service Center (OSC):

https://supporttickets.intel.com/?lang=en-US

0 Kudos