Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 524 forks source link

Perl_rcpv_new(): add assert(pv) #22115

Closed iabyn closed 4 weeks ago

iabyn commented 1 month ago

When this function is called with the RCPVf_USE_STRLEN flag, it gets the string length by calling strlen(pv). Coverity (CID 376192) points out that pv could be NULL.

This commit adds an assert(pv), so that the code will bail out on the line before the strlen() in this case, which is probably enough to silence Coverity. Perhaps we aught to have a proper croak() there, but this is a utility function mainly used in limited places in the core, where the caller likely knows that they're doing.