Opened 14 years ago

Closed 14 years ago

#4350 closed defect (fixed)

[with patch; with positive review] matrix_window -- easy to segfault sage at command line

Reported by: William Stein Owned by: William Stein
Priority: major Milestone: sage-3.2
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

See trac #4346 first and apply that patch.

  1. In this patch, matrix_window does *not* do bounds checking by default. This is because there is a bunch of internal usage of matrix_window for strassen algorithms, which actually relies on matrix_window not being bounds checked (it's ok as used by those algorithms). However, a bunch of code would have to be changed to make bounds checking of matrix_window the default. That said it is currently easy (even with this patch) to segfault sage interactively:
    sage: a = matrix([1]).matrix_window(1,1,1,1)
    sage: a
    
    Matrix window of size 1 x 1 at (1,1):
    [1]
    sage: a[0,0] = 1
    
    
    ------------------------------------------------------------
    Unhandled SIGSEGV: A segmentation fault occured in SAGE.
    This probably occured because a *compiled* component
    of SAGE has a bug in it (typically accessing invalid memory)
    or is not properly wrapped with _sig_on, _sig_off.
    You might want to run SAGE under gdb with 'sage -gdb' to debug this.
    SAGE will now terminate (sorry).
    ------------------------------------------------------------
    

Attachments (3)

sage-4350-part1.patch (7.5 KB) - added by William Stein 14 years ago.
sage-4350-part2.patch (3.2 KB) - added by William Stein 14 years ago.
sage-4350-part3.patch (17.7 KB) - added by Craig Citro 14 years ago.

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by William Stein

Attachment: sage-4350-part1.patch added

Changed 14 years ago by William Stein

Attachment: sage-4350-part2.patch added

comment:1 Changed 14 years ago by William Stein

Summary: matrix_window -- easy to segfault sage at command line[with patch; needs review] matrix_window -- easy to segfault sage at command line

NOTE: In writing this patch, I discovered that there was an off-by-one bug in the patch for #4346, which is fixed here. That was why the strassen code wasn't working. Now by default everything uses bounds checking. Very nice.

Note: the bugs in modular abelian varieties homspaces (trac #4351) are also fixed.

Changed 14 years ago by Craig Citro

Attachment: sage-4350-part3.patch added

comment:2 Changed 14 years ago by Craig Citro

Summary: [with patch; needs review] matrix_window -- easy to segfault sage at command line[with patch; with positive review] matrix_window -- easy to segfault sage at command line

Looks good. I've cleaned up a little bit of the code, and cpdef'd several of the functions in sage/matrix/matrix_window.pyx. I tested to see that this doesn't seem to slow down anything (such as matrix multiply), and now one can actually use the matrix_window class from the command line. (This is useful for debugging purposes in particular.)

comment:3 Changed 14 years ago by Michael Abshoff

Resolution: fixed
Status: newclosed

Merged all three patches in Sage 3.2.alpha1

Note: See TracTickets for help on using tickets.