This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
slen may be uninitialized.
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 7 May 2014 13:25:04 +0000 (09:25 -0400)
committerSteffen Mueller <smueller@cpan.org>
Wed, 28 May 2014 17:27:21 +0000 (19:27 +0200)
Fix for Coverity perl5 CID 29081: Uninitialized scalar
variable (UNINIT) uninit_use_in_call: Using uninitialized value slen when
calling Perl_croak.

If all fails, slen hasn't been set, and croak will be called with that.

utf8.c

diff --git a/utf8.c b/utf8.c
index 0ce3eb2..e97115f 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -2808,7 +2808,7 @@ Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8)
     HV *const hv = MUTABLE_HV(SvRV(swash));
     U32 klen;
     U32 off;
-    STRLEN slen;
+    STRLEN slen = 0;
     STRLEN needents;
     const U8 *tmps = NULL;
     U32 bit;