[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57284] Crash in MEX file when outputs are not

From: Rik
Subject: [Octave-bug-tracker] [bug #57284] Crash in MEX file when outputs are not used
Date: Thu, 21 Nov 2019 11:07:14 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #57284 (project octave):

                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 


Follow-up Comment #2:

This is invalid syntax.  The programmer needs to check the value of the
variable 'nlhs', which is the number of left-hand side variables, and only
write to variables which exist.  Prior to entering the mex function the Octave
interpreter has taken care of allocating an array of pointers to mxArray which
is sized according to the value of 'nlhs' and is given as the second argument
of the function:

mxArray *plhs[]

It is no surprise that trying to assign to unallocated memory results in

This is one of the reasons that Appendix A which discusses the mex and oct
file interfaces recommends staying within the Octave language if at all
possible.  Once you leave the interpreter you are programming for real and
stack overflows, segmentation faults, infinite loops, out-of-memory errors,
etc., etc. are all possible.


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]