[Scipy-tickets] [SciPy] #1562: linkage exists ungracefully when malloc fails

SciPy Trac scipy-tickets@scipy....
Thu Nov 17 14:55:34 CST 2011

#1562: linkage exists ungracefully when malloc fails
 Reporter:  laserson       |       Owner:  somebody   
     Type:  defect         |      Status:  new        
 Priority:  normal         |   Milestone:  Unscheduled
Component:  scipy.cluster  |     Version:  devel      
 Keywords:                 |  
 In scipy / cluster / src / hierarchy.c: line 415:

 `memcpy` is called on the pointer `dmt`.  However, if the matrix size is
 too large, `malloc` may fail to allocate the requested space, returning
 the null pointer to `dmt`.  This leads to a segmentation fault when
 `memcpy` is called.

 The fix would simply require checking whether `dmt` is the null pointer,
 and if so, to exit gracefully.

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

More information about the Scipy-tickets mailing list