Menu

Improving detection for null pointer dereferences

2023-04-15
2023-04-15
  • Markus Elfring

    Markus Elfring - 2023-04-15

    I observed that the analysis tool “Cppcheck 2.10.3-2.1” did not warn about undefined behaviour in the following source code example.

    int my_test(void)
    {
    struct x * p1 = NULL;
    struct y * p2 = &(p1->my_item);
    
    if (!p1)
       return EINVAL;
    
    return 0;
    }
    

    Will the software development attention grow according to such questionable access attempts for data structure members?

     
  • orbitcowboy

    orbitcowboy - 2023-04-15

    Thanks! A ticket was created here: https://trac.cppcheck.net/ticket/11668

     
    • Markus Elfring

      Markus Elfring - 2023-04-15
      • Will an unique subject become more helpful also for this issue?
      • Would you like to avoid any confusion for relevant content differences?
       

Log in to post a comment.