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

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

Thread Next
Andrew Church
November 16, 2003 07:46
[perl #24501] h2ph dies on >64-bit integers
Message ID:
# New Ticket Created by  Andrew Church 
# Please include the string:  [perl #24501]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
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;};
-	    && 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]
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:
    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
    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/, so=so, useshrplib=false, libperl=libperl.a
  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:

Environment for perl v5.8.2:
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About