octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #41053] out of bounds error in get_first_help_


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #41053] out of bounds error in get_first_help_sentence.m
Date: Wed, 01 Jan 2014 12:00:00 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22.1

URL:
  <http://savannah.gnu.org/bugs/?41053>

                 Summary: out of bounds error in get_first_help_sentence.m
                 Project: GNU Octave
            Submitted by: philipnienhuis
            Submitted on: Wed 01 Jan 2014 12:59:59 PM CET
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: philipnienhuis
         Originator Name: Philip Nienhuis
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

>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.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41053>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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