469,268 Members | 942 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,268 developers. It's quick & easy.

Hexadecimal number > 0xffffffff non-portable

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
10 18100
RonB
589 Expert Mod 512MB
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
$ 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
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
RonB
589 Expert Mod 512MB
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
RonB
589 Expert Mod 512MB
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
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, 992 views)
Jul 30 '09 #7
RonB
589 Expert Mod 512MB
We were posting about the same time, so you may have missed my last comment.

Try using Math::BigInt
Jul 30 '09 #8
RonB
589 Expert Mod 512MB
Another resource for the solution.
http://www.perlmonks.org/?node_id=742688
Jul 30 '09 #9
Hey many thanks,

Am not getting this error any more.

Thanks again.
Jul 30 '09 #10
numberwhun
3,503 Expert Mod 2GB
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.

Similar topics

10 posts views Thread by pavithra.eswaran | last post: by
2 posts views Thread by akash deep batra | last post: by
15 posts views Thread by jaks.maths | last post: by
8 posts views Thread by Vijay | last post: by
7 posts views Thread by elliotng.ee | last post: by
6 posts views Thread by Andrea | last post: by
6 posts views Thread by sweeet_addiction16 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.