develooper Front page | perl.perl5.porters | Postings from November 2003

[perl #24501] h2ph dies on >64-bit integers

Thread Next
From:
Andrew Church
Date:
November 16, 2003 07:46
Subject:
[perl #24501] h2ph dies on >64-bit integers
Message ID:
rt-24501-67500.11.6516724790889@rt.perl.org
# New Ticket Created by  Andrew Church 
# Please include the string:  [perl #24501]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24501 >



This is a bug report for perl from perlbug@achurch.org,
generated with the help of perlbug 1.34 running under perl v5.8.2.


-----------------------------------------------------------------
[Please enter your report here]

h2ph causes an integer overflow error and dies when used on an include file
containing a hexadecimal constant wider than 64 bits.  Such a constant can
be found, for example, in bn.h (line 108) from OpenSSL 0.9.7c:

#define BN_MASK		(0xffffffffffffffffffffffffffffffffLL)

Attempting to run this file through h2ph causes the error:

Integer overflow in hexadecimal number at /usr/bin/h2ph line 302, <IN> line 108.

The following patch serves to at least prevent this error from causing h2ph
to abort.  I'm not sure what the proper behavior should be, so I'll leave
that to those who do.

--- utils/h2ph.PL.old	2003-10-01 02:12:10.000000000 +0900
+++ utils/h2ph.PL	2003-11-14 15:15:12.000000000 +0900
@@ -329,7 +329,7 @@
 	s/^\&([\(a-z\)]+)/$1/i;	# hack for things that take the address of
 	s/^(\s+)//		&& do {$new .= ' '; next;};
 	s/^0X([0-9A-F]+)[UL]*//i 
-	    && do {my $hex = $1;
+	    &&eval{my $hex = $1;
 		   $hex =~ s/^0+//;
 		   if (length $hex > 8 && !$Config{use64bitint}) {
 		       # Croak if nv_preserves_uv_bits < 64 ?

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=utilities
    severity=medium
---
Site configuration information for perl v5.8.2:

Configured by root at Fri Nov 14 19:14:41 JST 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
  Platform:
    osname=linux, osvers=2.4.21, archname=i686-linux-ld
    uname='linux crystal 2.4.21 #15 sun sep 28 13:27:29 jst 2003 i686 unknown unknown linux '
    config_args='-des -Dprefix=/pkg/perl -Dccflags=-fno-strict-aliasing -DCOMPAT185 -Dcppflags=-DCOMPAT185 -Doptimize=-O3 -march=pentium4 -msse2 -Duselargefiles -Duselongdouble -Dglibpth=/lib /usr/lib -Dlddlflags=-shared -Uldflags= -Dlibpth=/lib /usr/lib -Dlibspth=/lib /usr/lib -Ulocincpth= -Uloclibpth= -Dd_dosuid -Dperlpath=/usr/bin/perl -Dstartperl=#!/usr/bin/perl -Dpager=/usr/bin/less -Dyacc=bison -y'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -DCOMPAT185 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 -march=pentium4 -msse2',
    cppflags='-DCOMPAT185 -fno-strict-aliasing -DCOMPAT185'
    ccversion='', gccversion='3.3.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/lib /usr/lib
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared'

Locally applied patches:
    

---
@INC for perl v5.8.2:
    /pkg/perl/lib/5.8.2/i686-linux-ld
    /pkg/perl/lib/5.8.2
    /pkg/perl/lib/site_perl/5.8.2/i686-linux-ld
    /pkg/perl/lib/site_perl/5.8.2
    /pkg/perl/lib/site_perl/5.8.1/i686-linux-ld
    /pkg/perl/lib/site_perl/5.8.1
    /pkg/perl/lib/site_perl/5.8.0/i686-linux-ld
    /pkg/perl/lib/site_perl/5.8.0
    /pkg/perl/lib/site_perl
    .

---
Environment for perl v5.8.2:
    HOME=/home/achurch
    LANG=ja_JP
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/achurch/lib
    LOGDIR (unset)
    PATH=/home/achurch:/home/achurch/bin:/home/achurch/bin/script:/usr/local/bin:/usr/bin:/bin:/usr/X11/bin:/usr/ucb:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/java/bin:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About