Opened 13 years ago

Closed 13 years ago

#359 closed bug (fixed)

crash with matrix-cast,

Reported by: gorzel Owned by: hannes
Priority: major Milestone: 3-1-4 and higher
Component: singular-kernel Version: 3-1-3
Keywords: matrix cast Cc:

Description

The cast matrix(A,n,m) for resizing a given matrix needs an errormessage if n or m are non-positive.

Otherwise it may cause some crash.

> ring r=0,x,dp;
> matrix(8,1,1);    
_[1,1]=8
> print(matrix(8,3,4));
8,0,0,0,
0,0,0,0,
0,0,0,0 
> matrix A = 8;
> A;
A[1,1]=8
> matrix(A,1,1);   // everythin if fine up to here but ...
_[1,1]=8

//... the following the non-postive second and third args should be rejected

> matrix(A,1,0);    // already this bug may lead to crash if used as input  

> matrix B = _;
> B;                // what is B ?

> size(B);
0
> ncols(B);
0
> nrows(B);   // mismatch with size(B)
1
> matrix(A,0,1);
_[1,1]=0
> matrix(A,-1,1);
_[1,1]=0

> matrix(1,-1,1);                       //  compare with the beginning
Singular : signal 11 (v: 3132/ 14363 ):
current line:>>matrix(1,-1,1);<<
Segment fault/Bus error occurred at 804af70 because of b7fa7000 (r:1313155815)
please inform the authors
trying to restart...

Finally I had to kill the process since Singular continued to run.

Change History (1)

comment:1 Changed 13 years ago by hannes

Resolution: fixed
Status: newclosed

fixed with rev.14415

Note: See TracTickets for help on using tickets.