Opened 14 years ago

Closed 14 years ago

#4346 closed defect (fixed)

[with patch; with positive review] segmentation fault with set_block

Reported by: Paul Zimmermann 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

----------------------------------------------------------------------
| SAGE Version 3.1.4, Release Date: 2008-10-16                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: M=Matrix([1])
sage: M.set_block(0,1,matrix([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 (1)

sage-4346.patch (5.7 KB) - added by William Stein 14 years ago.

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by William Stein

Attachment: sage-4346.patch added

comment:1 Changed 14 years ago by William Stein

The attached patch fixes the problem. However, there are two additional issues, which should be addressed as new tickets.

  1. After applying this patch and doctesting all sage, there are a bunch of failures in the modular abelian varieties code:
    	sage -t  devel/sage-main/sage/modular/abvar/abvar_ambient_jacobian.py # 3 doctests failed
    	sage -t  devel/sage-main/sage/modular/abvar/abvar_newform.py # 3 doctests failed
    	sage -t  devel/sage-main/sage/modular/abvar/morphism.py # 3 doctests failed
    	sage -t  devel/sage-main/sage/modular/abvar/homspace.py # 34 doctests failed
    	sage -t  devel/sage-main/sage/modular/abvar/abvar.py # 11 doctests failed
    

These are because of bugs in that code exposed by doing proper bounds checking. This is now trac #4351, and must also be fixed before #4346 can go into Sage.

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

This is now trac #4350.

comment:2 Changed 14 years ago by William Stein

Summary: segmentation fault with set_block[with patch; needs review] segmentation fault with set_block

comment:3 Changed 14 years ago by William Stein

NOTE: There is an off-by-one mistake in this patch, which is addressed by the second patch to #4350. Thus #4346 and #4350 should be refereed together.

comment:4 Changed 14 years ago by William Stein

Also, the fixes in #4350 fix the non-issue that caused me to open #4351.

comment:5 Changed 14 years ago by Craig Citro

Summary: [with patch; needs review] segmentation fault with set_block[with patch; with positive review] segmentation fault with set_block

Looks good, as long as you also apply the patches at #4350.

comment:6 Changed 14 years ago by Michael Abshoff

Resolution: fixed
Status: newclosed

Merged in Sage 3.2.alpha1

Note: See TracTickets for help on using tickets.