Results 1 to 3 of 3

Thread: Integer overflow error in DumpStream class

  1. #1
    Join Date
    Jan 2016
    Posts
    21

    Default Integer overflow error in DumpStream class

    Hello dear Yade developers!

    I'm trying to use Febio for simulation large scale mechanical problem. It seems to me that i got integer overflow bug in function:

    void DumpStream::grow_buffer(int l)
    {
    if (l <= 0) return;
    // MY_CHANGES
    //char* pnew = new char[m_nreserved + l];
    unsigned int uns_n = m_nreserved + l;
    char* pnew = new char[uns_n];
    if (m_pb)
    {
    memcpy(pnew, m_pb, m_nreserved);
    delete [] m_pb;
    }
    m_pb = pnew;
    m_pd = m_pb + m_nsize;
    m_nreserved += l;
    }

    So for big values of m_nreserved and l variables their addition (m_nreserved + l) gives negative result. So here it can be solved by using unsigned int variable uns_n. But i'm still wondering where else in the code should i make such changes to solve this error?

    with best regards Alexander

  2. #2
    Join Date
    Nov 2007
    Location
    Salt Lake City, UTAH
    Posts
    1,683

    Default

    Hi Alexander,

    Thanks for pointing this out. I will look into this issue.

    Cheers,

    Steve
    Department of Bioengineering, University of Utah
    Scientific Computing and Imaging institute, University of Utah

  3. #3
    Join Date
    Jan 2016
    Posts
    21

    Default

    Hi Steve.

    Please don't forget to tell me if you have fixed this bug.

    with best regards, Alexander

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •