gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
275 stars 61 forks source link

Crash in replicate_inplace #574

Closed zoglauer closed 11 months ago

zoglauer commented 5 years ago

Hello,

The following code crashes gdl with a "free(): invalid pointer" error on Ubuntu 18.04:

; Crash in replicate_inplace

IMAX=2     
JMAX=3         
KMAX=4         

M=replicate(1.0, IMAX, JMAX, KMAX)

; Works
;JIND=indgen(JMAX)
;replicate_inplace, M, 0.2, 1, [0,0,2], 2, JIND

; Crashes with "free(): invalid pointer"
replicate_inplace, M, 0.2, 1, [0,0,2], 2, indgen(JMAX)

print, M

The two lines following "; Works" are a way to circumvent the bug.

Best, Andreas

alaingdl commented 5 years ago

thanks

reproduced on my U14.04 (since at least vanilla 0.9.5) and last debian

Don't crash on OSX 10.12 !

alaingdl commented 5 years ago

the crash happens in those last four lines (basic_pro.cpp, lines ~2200) :


      MakeArrayIndex(&ixList, &ixL);
      Guard< ArrayIndexListT> ixL_guard(ixL);
      ixL->AssignAt(p0, p1);
      return;
GillesDuvert commented 4 years ago

the "Guard" should not be actived if "in place" I presume.

GillesDuvert commented 4 years ago

Additionnaly, using the 'safe'

JIND=indgen(JMAX)
replicate_inplace, M, 0.2, 1, [0,0,2], 2, JIND

there is a crash when repeating the last command. A temporary (!) cure is found and in #691