Menu

Index out of bounds in evaluate_gradp

2020-02-17
2020-02-17
  • Max Mertens

    Max Mertens - 2020-02-17

    Hello,
    there seems to be an array index out of bounds error in the recent GRAMPC (v2.1 and v2.2).
    In the file grampc_run.c towards the end of function evaluate_gradp(), the element t[i] is accessed, which is already behind the array bounds. This causes undefined behavior (undefined t values are given to the dVdp function). I guess it should be changed to t[grampc->opt->Nhor-1] (or t[i-1]).
    Thanks and kind regards,
    Max

     
  • Andreas Völz

    Andreas Völz - 2020-02-17

    Hello Max,

    thanks for the hint! You are right, line 892 in grampc_run.c should be changed from

           WtermParam(s, t[i], x, p_, dcdp, grampc);
    

    to

        WtermParam(s, t[grampc->opt->Nhor - 1], x, p_, dcdp, grampc);
    

    The bugfix will be included in the next version of GRAMPC.

    Regards,
    Andreas

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.