By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

Hexadecimal number > 0xffffffff non-portable

P: 6
Could someone please help me to resolve the following error.

Integer overflow in hexadecimal number at Keystore.pm line 1106.
Hexadecimal number > 0xffffffff non-portable Keystore.pm line 1106.

Thanks in advance
Jul 30 '09 #1
Share this Question
Share on Google+
10 Replies


Expert Mod 100+
P: 589
Can you post the complete line of code at line 1106?

What OS are you on?

What version of Perl are you using?

Do you get the same error from this test script?

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4.  
  5. print 0xffffffff, "\n";  # comment this line out if you receive the error
  6.  
  7. print 2**32, "\n";  # does this produce the same error?
  8.  
Jul 30 '09 #2

P: 6
$ cat test.pl
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4.  
  5. print 0xffffffff, "\n";  # comment this line out if you receive the error
  6.  
  7. print 2**32, "\n";  # does this produce the same error?
  8.  
$

$ perl test.pl
4294967295
4294967296
$



$ perl -v

This is perl, v5.8.4 built for sun4-solaris-64int
(with 31 registered patches, see perl -V for more detail)
Jul 30 '09 #3

P: 6
this is from the keystore.pm
Expand|Select|Wrap|Line Numbers
  1.     ####
  2.     # serial number
  3.     # extract hex certificate serial number (only required for -text format)
  4.     #$certinfo->{SerialNumber} =~ s/.*\(0x(.*)\)/$1/;
  5.  
  6.     # store decimal serial number
  7.     $certinfo->{Serial} = hex($certinfo->{SerialNumber});
  8.  
  9.     # pad with a leading zero if length is odd
  10.     if (length($certinfo->{SerialNumber}) % 2)
  11.     {
  12.         $certinfo->{SerialNumber} = '0' . $certinfo->{SerialNumber};
  13.     }
  14.     # convert to upcase and insert colons to separate hex bytes
  15.     $certinfo->{SerialNumber} = uc($certinfo->{SerialNumber});
  16.     $certinfo->{SerialNumber} =~ s/(..)/$1:/g;
  17.     $certinfo->{SerialNumber} =~ s/:$//;
  18.  
  19.     ####
  20.  
Jul 30 '09 #4

Expert Mod 100+
P: 589
Prior to the hex( ) command, what is the actual value of:
$certinfo->{SerialNumber}

If you uncomment this line, I'm willing to bet that the error goes away.
#$certinfo->{SerialNumber} =~ s/.*\(0x(.*)\)/$1/;

However, that may not give you the final results that you expect.
Jul 30 '09 #5

Expert Mod 100+
P: 589
I think I found the issue. Your OS is 64 bit, but it appears that Perl was built for 32 bit.

You should be able to get around this, without recompiling Perl, by using Math::BigInt
Expand|Select|Wrap|Line Numbers
  1. use Math::BigInt;
  2.  
  3. $certinfo->{Serial} = Math::BigInt->new($certinfo->{SerialNumber})->as_hex;
  4.  
Resource:
http://www.perlmonks.org/?node_id=616866
Jul 30 '09 #6

P: 6
Am sorry, still getting the same error.

Also, had attached the Keystore module.

Please rename Keystore.txt to Keystore.pm.

Thanks
Attached Files
File Type: txt Keystore.txt (47.8 KB, 886 views)
Jul 30 '09 #7

Expert Mod 100+
P: 589
We were posting about the same time, so you may have missed my last comment.

Try using Math::BigInt
Jul 30 '09 #8

Expert Mod 100+
P: 589
Another resource for the solution.
http://www.perlmonks.org/?node_id=742688
Jul 30 '09 #9

P: 6
Hey many thanks,

Am not getting this error any more.

Thanks again.
Jul 30 '09 #10

numberwhun
Expert Mod 2.5K+
P: 3,503
bprabhu17, you need to please start using code tags when you are posting code in the forums. They are required around any code you post, that way we don't have to clean up behind you.

Regards,

Jeff
Jul 30 '09 #11

Post your reply

Sign in to post your reply or Sign up for a free account.