Menu

False positive on zlib defalte usage?

tbeu
2024-02-25
2024-02-25
  • tbeu

    tbeu - 2024-02-25

    The zlib example code (demonstrated in http://zlib.net/zlib_how.html and available from http://zlib.net/zpipe.c) is reported as "Uninitialized variable: out" on line 70. The out buffer is indeed unitialized, but passed as strm.next_out to deflate function where it is used. I'd consider this as an edge case. What is best practice here? I know I can silence the error diagnostic via // cppcheck-suppress uninitvar comment.

     

    Last edit: tbeu 2024-02-25
  • tbeu

    tbeu - 2024-02-25

    Seems I can't edit the topic typo defalte->deflate.

     
  • CHR

    CHR - 2024-02-25

    The code looks similar to this issue: https://trac.cppcheck.net/ticket/12461

     
  • tbeu

    tbeu - 2024-02-25

    Right, pretty likely a duplicate. Thanks for the pointer.

     

    Last edit: tbeu 2024-02-25

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.