Menu

#5 adding int64_t and memory test

Unstable_(example)
open
nobody
None
5
2024-01-11
2021-07-07
Chris T
No

Adding 64bit integer and memory checking. Not tested on other UNIX

1 Attachments

Discussion

  • Chris T

    Chris T - 2021-07-07

    Patch to add int64_t support, and generic memory buffer tests

     
  • Bruno Raoult

    Bruno Raoult - 2024-01-11

    I can see issues in CuAssertMemEquals_LineMsg:

    1) If one of actual/expected is NULL, we will get a segfault:

    if ((expected == NULL && actual == NULL) ||    // both NULL
        (expected != NULL && actual != NULL &&     // both non NULL
         (memcmp(expected, actual, len)) == 0))
    {
        return;
    }
    
    /* below, dereferenced expected/actual are used, but we may have
     * one NULL, and get segfault.
     */
    

    2) buf is filled before checking for overflow. It means we can have an overflow:
    For example:

    c += sprintf(&buf[c],"expected <\n");
    assert(c < sizeof(buf));
    
     

    Last edit: Bruno Raoult 2024-01-12

Log in to post a comment.