[Scipy-tickets] [SciPy] #1311: ndimage.generic_filter segfaults

SciPy Trac scipy-tickets@scipy....
Fri Dec 24 19:13:50 CST 2010

#1311: ndimage.generic_filter segfaults
 Reporter:  jpaalasm       |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  high           |   Milestone:  0.9.0   
Component:  scipy.ndimage  |     Version:  0.8.0   
 Keywords:                 |  

Comment(by JustinPeel):

 This shouldn't be a valid input value for origin. Since the size is 3 and
 the default origin=0 corresponds with the middle, the valid range for
 origin is from -1 to 1. The function already raises an exception correctly
 for values of origin less than -1, but accepts values from -1 to 2. The
 patch that I've attached just changes a > to a >= so that only plausible
 values of origin are accepted. However, I think that other functions in
 the ndimage module might have a similar problem.

 Also, if the filter size is even then one valid value for origin is
 considered to be invalid by the function. Take the case of size=2. The
 default of origin=0 corresponds with the filter being centered on the
 second value of the filter. origin=-1 should be valid, but it currently
 isn't. However, I don't think that this is all that important because
 people don't often use even-sized filters and even less often use even-
 sized filters with the origin on the edge.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1311#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list