This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
XS-APItest: Length cannot be negative.
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 4 Feb 2016 02:42:36 +0000 (21:42 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 7 Feb 2016 13:23:46 +0000 (08:23 -0500)
Coverity CID 135019: Argument cannot be negative (NEGATIVE_RETURNS)

ext/XS-APItest/APItest.xs

index d7376ba..bbd00c7 100644 (file)
@@ -5490,6 +5490,7 @@ test_Gconvert(SV * number, SV * num_digits)
     CODE:
         len = (int) SvIV(num_digits);
         if (len > 99) croak("Too long a number for test_Gconvert");
+        if (len < 0) croak("Too short a number for test_Gconvert");
         PERL_UNUSED_RESULT(Gconvert(SvNV(number), len,
                  0,    /* No trailing zeroes */
                  buffer));