bugGNU Octave - Bugs: bug #52118, randg: missing documentation for...

 
 

bug #52118: randg: missing documentation for first argument A

Submitted by:  Pantxo Diribarne <pantxo>
Submitted on:  Tue 26 Sep 2017 10:21:01 AM UTC  
 
Category: Octave FunctionSeverity: 4 - Important
Priority: 5 - NormalItem Group: Documentation
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 26 Sep 2017 10:19:33 PM UTC, comment #5:

I checked in a change for the documentation on the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/a6cf8e06603a). The change was also merged on to default. Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Tue 26 Sep 2017 06:56:15 PM UTC, comment #4:

Yes I agree with all comment #3: the SIGSEGV looks like a false positive due the presence of the address sanitizer. The following also triggers the same SIGSEGV:

Only does the documentation have to be updated. Updating the title and the category of this report.

Pantxo Diribarne <pantxo>
Project Member
Tue 26 Sep 2017 05:28:35 PM UTC, comment #3:

Looking more closely, it does seem that the documentation needs to be fixed. The calling form for two inputs is really

rather than

as would be expected from the other randXXX functions and the documentation. Hence, when called with

the function is trying to create a 1e6 X 1e6 matrix which is quite large.

My first thought is that the documentation needs to be updated to be like that of randp which does properly document the first argument.

The second issue, the segfault, might just be a problem with the Address Sanitizer. I get a segfault when I execute

But when I run a version of Octave that hasn't been compiled with the Address Sanitizer then I get

This seems correct. The top of the backtrace log for me contains

I tried setting the variable suggested to control AddressSanitizer, and now I get a slightly different backtrace. However, my guess is that when compiled normally Octave just gets this right. The call to new() is too large and the library throws an exception which Octave then catches and returns an error message.

Rik <rik5>
Project Administrator
Tue 26 Sep 2017 05:11:14 PM UTC, comment #2:

There appears to be something wrong with the input validation for randg. Interestingly, if you look at the various randXXX functions, they all call do_rand to do the work. The prototype for do_rand is

Notice that additional_arg is usually false. The only functions which call do_rand with this argument set to true are randg and randp. So I tried

and this segfaults as well.

So it looks like the input additional_arg is the proximate cause, but it still needs to be tracked down why it is causing a problem.

Rik <rik5>
Project Administrator
Tue 26 Sep 2017 04:47:55 PM UTC, comment #1:

Confirmed. Even if the inputs are invalid, Octave should not segfault. Here is a longer backtrace from the Address Santizer.

Rik <rik5>
Project Administrator
Tue 26 Sep 2017 10:21:01 AM UTC, original submission:

The documentation for randg mentions the "A" argument but it is not mentioned in the list of call forms. So far this is a documentation bug.

Now if you try to call randg as you would call other rand* functions, e.g.

You'll get either "out of memory or dimension too large for Octave's index type" in Octave 4.2, or

with the current dev. and the address sanitizer enabled. For some reason I can't get any useful backtrace.

Pantxo Diribarne <pantxo>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by pantxo (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 26 Sep 2017 10:19:33 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Tue 26 Sep 2017 06:56:15 PM UTCpantxoItem GroupSegfault, Bus Error, etc.=>Documentation
      Summaryrandg: segfault with erroneous arguments=>randg: missing documentation for first argument A
    Tue 26 Sep 2017 05:11:14 PM UTCrik5Severity3 - Normal=>4 - Important
    Tue 26 Sep 2017 04:47:55 PM UTCrik5StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1