neurodroid/stimfit — pull request #7 by kh90909 (2014-11-24 00:31:02+00:00)
Title: Fix std::copy index out of range bug in pystfio Section.asarray()

Hello,

I built a Win64 version of the python stfio module with VS2008, but found that python would die whenever `Section.asarray()` was executed. After wrangling VS2008 and python into building a debug version of the library, I traced this to a bug in `Section.asarray()`. `$self->operator[]($self-size())` was being used to get the last+1 index of the array, but since this index is out of range, `operator[]()` was throwing an exception. The correct method seems to be to use the iterator class `.begin()` and `.end()` methods, as I have done in this commit.

I suspect this issue happens with VS2008 win32 also, but if so, it's strange that you haven't encountered it already. Maybe you build the win32 version with MXE instead of VS2008?

(FYI I successfully used VC2008 Express to build this Win64 version of py-stfio. You can see the changes in my fork, I'll create a separate discussion about this).