Skip Menu |

This queue is for tickets about the Math-Int64 CPAN distribution.

Report information
The Basics
Id: 98734
Status: resolved
Priority: 0/
Queue: Math-Int64

People
Owner: Nobody in particular
Requestors: mdonovan [...] mac.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: BER_length returns uninitialized value
Date: Tue, 09 Sep 2014 05:54:18 -0700
To: bug-Math-Int64 [...] rt.cpan.org
From: Mark Donovan <mdonovan [...] mac.com>
Math::Int64 0.30 Perl v5.16.2 Darwin Kernel Version 13.3.0 (Mac OS X 10.9) Problem: Int64.xs:573 warning: & has lower precedence than ==; == will be evaluated first (pv[i] & 0x80 == 0) is never true because 0x80 == 0 is false. To reproduce: my $i64 = int64(0xdeadbeef); my $ber = int64_to_BER($i64); print BER_length($ber); Expected result: 5 Result: Use of uninitialized value in print *** Int64-old.xs 2013-06-03 08:52:18.000000000 -0700 --- Int64.xs 2014-09-08 22:06:07.000000000 -0700 *************** *** 570,576 **** unsigned char *pv = SvPVbyte(sv, len); IV i; for (i = 0; i < len; i++) { ! if (pv[i] & 0x80 == 0) return i + 1; } return -1; } --- 570,576 ---- unsigned char *pv = SvPVbyte(sv, len); IV i; for (i = 0; i < len; i++) { ! if ((pv[i] & 0x80) == 0) return i + 1; } return -1; } There are no tests for BER_length. --
Fixed on version 0.32 (https://metacpan.org/release/SALVA/Math-Int64-0.32). Thank you for reporting the issue!