Code Monkey home page Code Monkey logo

Comments (5)

jrandall avatar jrandall commented on July 20, 2024

I've now also run it through valgrind, and it is reporting some problems with the write to ww2 by the vst function (and the subsequent read by the vvp function).

Valgrind output is below (note that the source line numbers are slightly off because I've added some debug printing to this version of the code).

==58456== Invalid write of size 8
==58456==    at 0x43C529: vst (vsubs.c:27)
==58456==    by 0x40A56A: initvmix (qpGraph.c:2165) 
==58456==    by 0x404F50: main (qpGraph.c:812)      
==58456==  Address 0x3d525908 is 0 bytes after a block of size 104 alloc'd
==58456==    at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 
==58456==    by 0x40A0DC: initvmix (qpGraph.c:2104) 
==58456==    by 0x404F50: main (qpGraph.c:812)      
==58456==                                 
==58456== Invalid read of size 8          
==58456==    at 0x43C622: vvp (vsubs.c:43)
==58456==    by 0x40A581: initvmix (qpGraph.c:2166) 
==58456==    by 0x404F50: main (qpGraph.c:812)      
==58456==  Address 0x3d525908 is 0 bytes after a block of size 104 alloc'd
==58456==    at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 
==58456==    by 0x40A0DC: initvmix (qpGraph.c:2104) 
==58456==    by 0x404F50: main (qpGraph.c:812)      
==58456==                                 
--58456-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting       
--58456-- si_code=80;  Faulting address: 0x0;  sp: 0x402bdae00

In my modified code, qpGraph.c:2166 is: vst(ww2, wwinit, 0.5, nwts) ; and qpGraph.c:2167 is vvp(ww, ww, ww2, nwts) ;

from admixtools.

jrandall avatar jrandall commented on July 20, 2024

With our data, nwts = 18 and nvar = 13, so when vst(ww2, wwinit, 0.5, nwts) loops over ww2 to update it, there is a buffer overrun because nwts is greater than the size of the ww2 vector.

from admixtools.

bumblenick avatar bumblenick commented on July 20, 2024

from admixtools.

jrandall avatar jrandall commented on July 20, 2024

@bumblenick I am sure that will fix the problem, as it would necessarily make nvar at least as large as nwts, a more explicit version of which is the fix I already tried and can confirm is working (see PR #18).

from admixtools.

bumblenick avatar bumblenick commented on July 20, 2024

from admixtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.