Subject: | Overflow when user defined function returns values >= 2^31 |
Date: | Tue, 24 Jul 2007 12:19:40 +0200 |
To: | <bug-DBD-SQLite2 [...] rt.cpan.org> |
From: | "Skora, Thomas" <Thomas.Skora [...] secunet.com> |
Here the information about the system where this problem was reproduced:
----------------------
Show quoted text
cpan> i DBD::SQLite2
CPAN: Storable loaded ok
Going to read /cpan/Metadata
Database was generated on Mon, 23 Jul 2007 03:51:52 GMT
Strange distribution name [DBD::SQLite2]
Module id = DBD::SQLite2
CPAN_USERID MSERGEANT (MSERGEANT <msergeant@cpan.org>)
CPAN_VERSION 0.33
CPAN_FILE M/MS/MSERGEANT/DBD-SQLite2-0.33.tar.gz
MANPAGE DBD::SQLite2 - Self Contained RDBMS in a DBI Driver
(sqlite 2.x)
INST_FILE /usr/lib/perl5/site_perl/5.8/cygwin/DBD/SQLite2.pm
INST_VERSION 0.33
$ perl -v
This is perl, v5.8.7 built for cygwin-thread-multi-64int
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2005, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=cygwin, osvers=1.5.18(0.13242),
archname=cygwin-thread-multi-64int
uname='cygwin_nt-5.1 inspiron 1.5.18(0.13242) 2005-07-02 20:30 i686
unknown unknown cygwin '
config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads
-Uusemymalloc -Doptimize=-O3 -Dman3ext=3pm -Dusesitecustomize'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing
-pipe -I/usr/local/include',
optimize='-O3',
cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe
-I/usr/local/include'
ccversion='', gccversion='3.4.4 (cygming special) (gdc 0.12, using
dmd 0.125)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='ld2', ldflags =' -s -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -ldb -lcrypt -lgdbm_compat
perllibs=-lcrypt -lgdbm_compat
libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_64_BIT_INT
USE_LARGE_FILES USE_SITECUSTOMIZE
PERL_IMPLICIT_CONTEXT
Locally applied patches:
SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962
Built under cygwin
Compiled at Dec 30 2005 02:44:25
%ENV:
CYGWIN=""
@INC:
/usr/lib/perl5/5.8/cygwin
/usr/lib/perl5/5.8
/usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8
/usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8
.
$ uname -a
CYGWIN_NT-5.1 SN-E0490 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin
----------------------
The same problem occurs also on a Linux box with perl 5.8.8 and the same
DBD::SQLite2 version.
A code Piece which reproduces this bug:
---------------------
#!/usr/bin/perl
use DBI;
sub return_big {
return 2**32;
}
my $dbh = DBI->connect("dbi:SQLite2:dbname=foo", "", "", { PrintError =>
0 } );
$dbh->func( "bignumber", 0, \&return_big, "create_function" );
my $result = $dbh->selectrow_arrayref( "SELECT bignumber()" );
print $$result[0];
---------------------