Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: special: Invalid arguments to ellip_harm can crash Python.
For example, In [1]: from scipy.special import ellip_harm In [2]: n = 4 In [3]: p = 2*n + 2 # Too big! In [4]: ellip_harm(0.5, 2.0, n, p, 0.2) python(74331,0x7fff7c7ce310) malloc: *** error for object 0x120c1d110: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap: 6 The problem was that when the function `lame_coefficients` detected invalid arguments, it returned without initializing bufferp[0]. In normal use, bufferp[0] is malloc'ed by `lame_coefficients` and must be freed by the caller. If `lame_coefficients` failed to initialize bufferp[0] with NULL, the value returned in bufferp[0] would be garbage, and that would cause a crash when the caller attempted to free the memory.
- Loading branch information