On Tue, May 6, 2008 at 4:05 PM, Michael Goffioul
<[EMAIL PROTECTED]> wrote:
>  I looked further and while debugging, I found suspicious code
>  in octave_swig_packed::copy:
>
>  std::copy(&buf[0], &buf[sz], (char*)ptr);
>
>  While this looks nice, this code is accessing memory
>  outside the allocated area for buf: when sz == buf.size(),
>  then buf[sz] is outside the bounds of buf. When replacing
>  it with:
>
>  memcpy(ptr, &buf[0], sz);
>
>  everything works fine.
>
>  Another source of null-referencing is in octave_swig_packed::print:
>  as "type" can be NULL, type->name is unsafe. One example of
>  such object is created in SWIG_Octave_SetModule.

Additional sources of compilation problems are the following:
1) -lm is hard-coded as link-time library in a few Makefile's; this
library does not exist under MSVC. This should be handled
in the configure script
2) some Makefile's are assuming that executables have no
suffix, while they have .exe suffix under Windows; the "mv"
command then fails
3) ANN.h should also use STATIC_LINKED to avoid decorating
symbols with dllexport/dllimport and -DSTATIC_LINKED should be
added to compilation flags
4) -DANN_NO_RANDOM should be added to compilation flags
under Win32
5) "libANN.a" and "ar" are hardcoded in Makeconf.in, while they
should be "ANN.lib" and ar-msvc under MSVC. ar-msvc is able to
do the libANN.a->ANN.lib conversion for you, but as the Makefile
moves the file around, the "mv" command fails (as it uses
libANN.a)
6) ann2fig compilation does not uses CXXFLAGS

Michael.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to