473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 20727
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, 1091 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,509 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

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

Similar topics

3
by: Todd | last post by:
Our ASP.NET (C#) application accepts form entry and saves inputed data in XML. We are finding that users are sometimes cutting and pasting special characters (from MS Word) into these forms....
10
by: pavithra.eswaran | last post by:
Hi, I would like to convert a single precision hexadecimal number to floating point. The following program seems to work fine.. But I do not want to use scanf. I already have a 32 bit hexadecimal...
2
by: akash deep batra | last post by:
hi i want to convert a 96 bit binary number into a hexadecimal number. e.g binary number= 001100010001010000100101011110111111010101110100010110000101011000101010000000000000000000000000 how...
15
by: jaks.maths | last post by:
How to convert negative integer to hexadecimal or octal number? Ex: -568 What is the equivalent hexadecimal and octal number??
8
by: Vijay | last post by:
Hi , I am doing a small project in c. I have a Hexadecimal file and want to convert into ascii value. (i.e., Hexadecimal to Ascii conversion from a file). Could anyone help me? Thanks in...
14
by: dharmdeep | last post by:
Hi friends, I need a sample code in C which will convert a Hexadecimal number into decimal number. I had written a code for that but it was too long, I need a small code, so request u all to...
7
by: elliotng.ee | last post by:
I have a text file that contains a header 32-bit binary. For example, the text file could be: %%This is the input text %%test.txt Date: Tue Dec 26 14:03:35 2006...
6
by: Andrea | last post by:
Hi, suppose that I have a string that is an hexadecimal number, in order to print this string I have to do: void print_hex(unsigned char *bs, unsigned int n){ int i; for (i=0;i<n;i++){...
6
by: sweeet_addiction16 | last post by:
hello Im writin a code in c... can sum1 pls help me out in writing a c code to convert decimalnumber to hexadecimal number.The hexadecimal number generated has to be an unsigned long.
14
by: Ellipsis | last post by:
Ok so I am converting to hexadecimal from decimal and I can only cout the reverse order of the hexadecimal?! How could I reverse this so its the right order? Heres my code: #include <iostream>...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.