rats crashes Octave

View: New views
3 Messages — Rating Filter:   Alert me  

rats crashes Octave

by tlhiv :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

it seems that the function `rats` called with no arguments segfaults Octave here for me on 4 different machines.  Each of these machines are running Octave 3.0.1 in Gentoo Linux x86_64.  The output I get is

octave:1> rats
panic: Segmentation fault -- stopping myself...
attempting to save variables to `octave-core'...
save to `octave-core' complete
Segmentation fault

[Changeset]: Re: rats crashes Octave

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

tlhiv wrote:

> it seems that the function `rats` called with no arguments segfaults Octave
> here for me on 4 different machines.  Each of these machines are running
> Octave 3.0.1 in Gentoo Linux x86_64.  The output I get is
>
> octave:1> rats
> panic: Segmentation fault -- stopping myself...
> attempting to save variables to `octave-core'...
> save to `octave-core' complete
> Segmentation fault
>  
Opps, the attached changeset addresses this..

D.

--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary


# HG changeset patch
# User David Bateman <dbateman@...>
# Date 1214390792 -7200
# Node ID a3e7e24a6359c9c962390c6d364952d685eb1664
# Parent  1bb8e965e5b5547877f98869bda37935f20399d1
Frats fix for nargin==0

diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@ 2008-06-10  John W. Eaton  <jwe@...
+2008-06-25  David Bateman  <dbateman@...>
+
+ * pr-output.cc (Frats): Print usage if nargin == 0.
+
 2008-06-10  John W. Eaton  <jwe@...>
 
  * mexproto.h (mxCreateLogicalScalar): Declar arg as mxLogical, not int.
diff --git a/src/pr-output.cc b/src/pr-output.cc
--- a/src/pr-output.cc
+++ b/src/pr-output.cc
@@ -2766,18 +2766,20 @@ representing the elements of @var{x}. By
 
   int nargin = args.length ();
 
-  unwind_protect::begin_frame ("Frats");
-
-  unwind_protect_int (rat_string_len);
-
-  rat_string_len = 9;
-
-  if (nargin == 2)
-    rat_string_len = args(1).nint_value ();
-
-  if (! error_state)
-    {
-      if (nargin < 3 && nargout < 2)
+  if (nargin < 1 || nargin > 2 || nargout > 1)
+    print_usage ();
+  else
+    {
+      unwind_protect::begin_frame ("Frats");
+
+      unwind_protect_int (rat_string_len);
+
+      rat_string_len = 9;
+
+      if (nargin == 2)
+ rat_string_len = args(1).nint_value ();
+
+      if (! error_state)
  {
   octave_value arg = args(0);
 
@@ -2817,8 +2819,6 @@ representing the elements of @var{x}. By
   else
     error ("rats: expecting numeric input");
  }
-      else
- print_usage ();
     }
 
   unwind_protect::run_frame ("Frats");

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

[Changeset]: Re: rats crashes Octave

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 25-Jun-2008, David Bateman wrote:

| tlhiv wrote:
| > it seems that the function `rats` called with no arguments segfaults Octave
| > here for me on 4 different machines.  Each of these machines are running
| > Octave 3.0.1 in Gentoo Linux x86_64.  The output I get is
| >
| > octave:1> rats
| > panic: Segmentation fault -- stopping myself...
| > attempting to save variables to `octave-core'...
| > save to `octave-core' complete
| > Segmentation fault
| >  
| Opps, the attached changeset addresses this..

Thanks.  I applied this changeset and also moved the call to
unwind_protect::run_frame ("Frats") so that it is in the same block as
the call to unwind_protect:;begin_frame ("Frats").

jwe
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave