long suffix in .mod files results in *** buffer overflow detected *** error

Post Reply
JustasB
Posts: 14
Joined: Tue Dec 08, 2015 8:17 pm

long suffix in .mod files results in *** buffer overflow detected *** error

Post by JustasB » Sat Nov 04, 2017 7:04 pm

Hello,

It appears that if the SUFFIX in the NEURON section of a .mod file is more than 48 characters long, then compiling the mod file with "nrnivmodl" command results in a hard-to-debug error.

For example, the following suffix:

Code: Select all

NEURON {
    SUFFIX napf_spinstell__a0__b0__c0__d0__fastNa_shiftmin2_:5
    ...
}
Results in:

Code: Select all

Translating na.mod into na.c
*** buffer overflow detected ***: /home/justas/neuron/nrn/x86_64/bin/nocmodl terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fc517e577e5]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7fc517ef911c]
/lib/x86_64-linux-gnu/libc.so.6(+0x117120)[0x7fc517ef7120]
/lib/x86_64-linux-gnu/libc.so.6(+0x116689)[0x7fc517ef6689]
/lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0x80)[0x7fc517e5b6b0]
/lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0x139b)[0x7fc517e2e50b]
/lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x84)[0x7fc517ef6714]
/lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x7fc517ef666d]
/home/justas/neuron/nrn/x86_64/bin/nocmodl[0x415584]
/home/justas/neuron/nrn/x86_64/bin/nocmodl[0x401389]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fc517e00830]
/home/justas/neuron/nrn/x86_64/bin/nocmodl[0x401519]
======= Memory map: ========
00400000-00436000 r-xp 00000000 08:01 810130                             /home/justas/neuron/nrn/x86_64/bin/nocmodl
00635000-00636000 r--p 00035000 08:01 810130                             /home/justas/neuron/nrn/x86_64/bin/nocmodl
00636000-00637000 rw-p 00036000 08:01 810130                             /home/justas/neuron/nrn/x86_64/bin/nocmodl
00637000-0064b000 rw-p 00000000 00:00 0 
00ca7000-00cc8000 rw-p 00000000 00:00 0                                  [heap]
7fc517bca000-7fc517be0000 r-xp 00000000 08:01 792656                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc517be0000-7fc517ddf000 ---p 00016000 08:01 792656                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc517ddf000-7fc517de0000 rw-p 00015000 08:01 792656                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fc517de0000-7fc517fa0000 r-xp 00000000 08:01 794227                     /lib/x86_64-linux-gnu/libc-2.23.so
7fc517fa0000-7fc5181a0000 ---p 001c0000 08:01 794227                     /lib/x86_64-linux-gnu/libc-2.23.so
7fc5181a0000-7fc5181a4000 r--p 001c0000 08:01 794227                     /lib/x86_64-linux-gnu/libc-2.23.so
7fc5181a4000-7fc5181a6000 rw-p 001c4000 08:01 794227                     /lib/x86_64-linux-gnu/libc-2.23.so
7fc5181a6000-7fc5181aa000 rw-p 00000000 00:00 0 
7fc5181aa000-7fc5181c2000 r-xp 00000000 08:01 793192                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc5181c2000-7fc5183c1000 ---p 00018000 08:01 793192                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc5183c1000-7fc5183c2000 r--p 00017000 08:01 793192                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc5183c2000-7fc5183c3000 rw-p 00018000 08:01 793192                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fc5183c3000-7fc5183c7000 rw-p 00000000 00:00 0 
7fc5183c7000-7fc5183ed000 r-xp 00000000 08:01 792995                     /lib/x86_64-linux-gnu/ld-2.23.so
7fc5185cf000-7fc5185d2000 rw-p 00000000 00:00 0 
7fc5185e9000-7fc5185ec000 rw-p 00000000 00:00 0 
7fc5185ec000-7fc5185ed000 r--p 00025000 08:01 792995                     /lib/x86_64-linux-gnu/ld-2.23.so
7fc5185ed000-7fc5185ee000 rw-p 00026000 08:01 792995                     /lib/x86_64-linux-gnu/ld-2.23.so
7fc5185ee000-7fc5185ef000 rw-p 00000000 00:00 0 
7ffe51200000-7ffe51222000 rw-p 00000000 00:00 0                          [stack]
7ffe51324000-7ffe51326000 r--p 00000000 00:00 0                          [vvar]
7ffe51326000-7ffe51328000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)
/home/justas/neuron/nrn/x86_64/bin/nrnmech_makefile:84: recipe for target 'na.lo' failed
make: *** [na.lo] Error 134

While, the following suffix compiles successfully:

Code: Select all

NEURON {
    SUFFIX napf_spinstell__a0__b0__c0__d0__fastNa_shiftmin2:_5
    ...
}
It would be very valuable to non-programmer and inexperienced NEURON users if this problem was detected during nrnivmodl compilation and a more user friendly message, mentioning suffix length limitations, displayed. Currently, neither the message or the stack trace suggests that there is a problem with the suffix name length.

This occurs on:
NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Ubuntu 16.04

hines
Site Admin
Posts: 1527
Joined: Wed May 18, 2005 3:32 pm

Re: long suffix in .mod files results in *** buffer overflow detected *** error

Post by hines » Mon Nov 06, 2017 9:28 am

That problem was fixed in version 7.5. The SUFFIX can now be up to 256 characters in length.
https://github.com/nrnhines/nrn/commit/ ... 250438a8ba
Date: Sun Aug 6 10:10:29 2017 -0400
Increase size of string arrays to allow long suffix names.
...

Post Reply