Fix Coverity issues from async auth feature#4854
Merged
Conversation
- Zero-initialize chal_param before use to fix uninitialized user_data field (CID 1645641, 1645645, 1645648, 1645649, 1645652, 1645655, 1645656, 1645658, 1645659) - Check pjsip_endpt_create/pjsip_tsx_layer_init_module return values in restore_endpt() (CID 1645646, 1645653, 1645657) - Use goto on_return for UDP transport failure to fix null pointer dereference path (CID 1645640) - Check pjsip_rx_data_clone return value and reject call on failure to prevent silent on_incoming_call skip (CID 1645647) - Use std::move for push_back (CID 1645651) Co-Authored-By: Claude Code
| if (with_creds) { | ||
| AuthCredInfo cred("digest", "*", TEST_USER, 0, "secret"); | ||
| cfg.sipConfig.authCreds.push_back(cred); | ||
| cfg.sipConfig.authCreds.push_back(std::move(cred)); |
Contributor
There was a problem hiding this comment.
Isn't there a macro?
Member
Author
There was a problem hiding this comment.
Good catch! Thanks for pointing it out.
Co-Authored-By: Claude Code
sauwming
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chal_paramstruct before use across 10 call sites to silence uninitializeduser_datafield warningspjsip_endpt_create()andpjsip_tsx_layer_init_module()in test helperauth_async_test()cleanup pathpjsip_rx_data_clone()return value inpjsua_call_on_incoming()and reject the call with 500 on failure (previously a failed clone would silently skip theon_incoming_callcallback)std::move()forpush_backin C++ test codeCoverity CIDs addressed
pj_bzero(&chal_param, sizeof(chal_param))restore_endpt()goto on_returninstead of earlyreturnpjsip_rx_data_clone(), reject call on failurestd::move(cred)Not addressed (false positives)
unique_ptr<TestAccount>internal pointer escapes viaacc->create()— intentional PJSUA2 account registration pattern in test codeTest plan
make -j3)Co-Authored-By: Claude Code