bugGNU Octave - Bugs: bug #41053, out of bounds error in...

 
 

bug #41053: out of bounds error in get_first_help_sentence.m

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Wed 01 Jan 2014 11:59:59 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 02 Jan 2014 05:08:50 PM UTC, comment #2: 

I applied your patch to the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/f80d258a2c7d).

Rik <rik5>
Group administrator
Thu 02 Jan 2014 10:58:08 AM UTC, comment #1: 

patch attached

(file #30147)

Philip Nienhuis <philipnienhuis>
Group Member
Wed 01 Jan 2014 11:59:59 AM UTC, original submission:  

From the discussion in patch #8099 it emerged that get_first_help_sentence function could be made more robust.

The stanza in L.127-131:

    end_idx = strfind (help_text, sprintf ("@end %s", def_type))(1);
    if (isempty (end_idx))
      error ("get_first_help_sentence: couldn't parse texinfo");
    endif
    keep(end_idx:end) = false;


contains the almost classical pitfall of already taking the first element of some output array before testing whether it is empty. The fix is of course easy, it had better read as follows:

    end_idx = strfind (help_text, sprintf ("@end %s", def_type));
    if (isempty (end_idx))
      error ("get_first_help_sentence: couldn't parse texinfo");
    endif
    keep(end_idx(1):end) = false;


I'll prepare a cset.

Philip Nienhuis <philipnienhuis>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-02 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2014-01-02 philipnienhuis Attached File- Added get_first_help_sentence.cs, #30147
        StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code