From edd at debian.org  Tue Jan 26 03:14:28 2010
From: edd at debian.org (Dirk Eddelbuettel)
Date: Mon, 25 Jan 2010 20:14:28 -0600
Subject: [Rd] Stack smashing in RODBC
In-Reply-To: <4B5E49D9.7000403@redhat.com>
References: <4B5E49D9.7000403@redhat.com>
Message-ID: <19294.20484.362175.286202@ron.nulle.part>


On 25 January 2010 at 20:48, "Tom \"spot\" Callaway" wrote:
| This is R 2.10.1, from Fedora 12 and RODBC 1.3-1 (although 1.3-0 has the
| same problem) on i686.
| 
| Originally reported here:
| https://bugzilla.redhat.com/show_bug.cgi?id=557953
| 
| Reproducer and output below:
| 
| [spot at f12.i386 src]$ R
| 
| R version 2.10.1 (2009-12-14)
| Copyright (C) 2009 The R Foundation for Statistical Computing
| ISBN 3-900051-07-0
| 
| R is free software and comes with ABSOLUTELY NO WARRANTY.
| You are welcome to redistribute it under certain conditions.
| Type 'license()' or 'licence()' for distribution details.
| 
|   Natural language support but running in an English locale
| 
| R is a collaborative project with many contributors.
| Type 'contributors()' for more information and
| 'citation()' on how to cite R or R packages in publications.
| 
| Type 'demo()' for some demos, 'help()' for on-line help, or
| 'help.start()' for an HTML browser interface to help.
| Type 'q()' to quit R.
| 
| > library(RODBC)
| > channel <- odbcConnect("foo", uid="bar")
| *** stack smashing detected ***: /usr/lib/R/bin/exec/R terminated
| ======= Backtrace: =========
| /lib/libc.so.6(__fortify_fail+0x4d)[0x59d1ed]
| /lib/libc.so.6[0x59d19a]
| /usr/lib/R/library/RODBC/libs/RODBC.so(+0x6164)[0x753164]
| /usr/lib/R/library/RODBC/libs/RODBC.so(RODBCDriverConnect+0x4ed)[0x74f072]
| /usr/lib/R/lib/libR.so(+0x8601c)[0x1c901c]
| /usr/lib/R/lib/libR.so(Rf_eval+0x7f2)[0x1eca82]
| /usr/lib/R/lib/libR.so(+0xabfd5)[0x1eefd5]
| /usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x1ec7f8]
| /usr/lib/R/lib/libR.so(+0xac0eb)[0x1ef0eb]
| /usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x1ec7f8]
| /usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x1f0ac7]
| /usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x1ec69d]
| /usr/lib/R/lib/libR.so(+0xaa43a)[0x1ed43a]
| /usr/lib/R/lib/libR.so(+0xf5e9e)[0x238e9e]
| /usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x1ec7f8]
| /usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x1f0ac7]
| /usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x1ec69d]
| /usr/lib/R/lib/libR.so(+0xac0eb)[0x1ef0eb]
| /usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x1ec7f8]
| /usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x1f0ac7]
| /usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x1ec69d]
| /usr/lib/R/lib/libR.so(+0xac0eb)[0x1ef0eb]
| /usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x1ec7f8]
| /usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x1f0ac7]
| /usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x1ec69d]
| /usr/lib/R/lib/libR.so(+0xabfd5)[0x1eefd5]
| /usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x1ec7f8]
| /usr/lib/R/lib/libR.so(Rf_ReplIteration+0x23d)[0x22764d]
| /usr/lib/R/lib/libR.so(+0xe49a5)[0x2279a5]
| /usr/lib/R/lib/libR.so(run_Rmainloop+0x66)[0x228236]
| /usr/lib/R/lib/libR.so(Rf_mainloop+0x1d)[0x22826d]
| /usr/lib/R/bin/exec/R(main+0x39)[0x8048699]
| /lib/libc.so.6(__libc_start_main+0xe6)[0x4bfbb6]
| /usr/lib/R/bin/exec/R[0x8048591]
| ======= Memory map: ========
| 00110000-00138000 r-xp 00000000 fd:00 478        /lib/libm-2.11.1.so
| 00138000-00139000 r--p 00027000 fd:00 478        /lib/libm-2.11.1.so
| 00139000-0013a000 rw-p 00028000 fd:00 478        /lib/libm-2.11.1.so
| 0013a000-0013d000 r-xp 00000000 fd:00 479        /lib/libdl-2.11.1.so
| 0013d000-0013e000 r--p 00002000 fd:00 479        /lib/libdl-2.11.1.so
| 0013e000-0013f000 rw-p 00003000 fd:00 479        /lib/libdl-2.11.1.so
| 00143000-003b3000 r-xp 00000000 fd:00 223583     /usr/lib/R/lib/libR.so
| 003b3000-003c1000 rw-p 00270000 fd:00 223583     /usr/lib/R/lib/libR.so
| 003c1000-00457000 rw-p 00000000 00:00 0
| 00457000-00469000 r-xp 00000000 fd:00 630        /lib/libz.so.1.2.3
| 00469000-0046a000 rw-p 00011000 fd:00 630        /lib/libz.so.1.2.3
| 0046a000-00480000 r-xp 00000000 fd:00 17315      /lib/libtinfo.so.5.7
| 00480000-00483000 rw-p 00015000 fd:00 17315      /lib/libtinfo.so.5.7
| 00487000-004a5000 r-xp 00000000 fd:00 462        /lib/ld-2.11.1.so
| 004a5000-004a6000 r--p 0001d000 fd:00 462        /lib/ld-2.11.1.so
| 004a6000-004a7000 rw-p 0001e000 fd:00 462        /lib/ld-2.11.1.so
| 004a9000-00618000 r-xp 00000000 fd:00 463        /lib/libc-2.11.1.so
| 00618000-0061a000 r--p 0016e000 fd:00 463        /lib/libc-2.11.1.so
| 0061a000-0061b000 rw-p 00170000 fd:00 463        /lib/libc-2.11.1.so
| 0061b000-0061e000 rw-p 00000000 00:00 0
| 0061e000-006f3000 r-xp 00000000 fd:00 46452
| /usr/lib/libgfortran.so.3.0.0
| 006f3000-006f5000 rw-p 000d4000 fd:00 46452
| /usr/lib/libgfortran.so.3.0.0
| 006f5000-0070b000 r-xp 00000000 fd:00 476        /lib/libpthread-2.11.1.so
| 0070b000-0070c000 r--p 00015000 fd:00 476        /lib/libpthread-2.11.1.so
| 0070c000-0070d000 rw-p 00016000 fd:00 476        /lib/libpthread-2.11.1.so
| 0070d000-0070f000 rw-p 00000000 00:00 0
| 0070f000-0072c000 r-xp 00000000 fd:00 356
| /lib/libgcc_s-4.4.2-20091222.so.1
| 0072c000-0072d000 rw-p 0001c000 fd:00 356
| /lib/libgcc_s-4.4.2-20091222.so.1
| 0072d000-0074c000 r-xp 00000000 fd:00 225135
| /usr/lib/R/library/grDevices/libs/grDevices.so
| 0074c000-0074d000 rw-p 0001f000 fd:00 225135
| /usr/lib/R/library/grDevices/libs/grDevices.so
| 0074d000-00755000 r-xp 00000000 fd:00 227777
| /usr/lib/R/library/RODBC/libs/RODBC.so
| 00755000-00756000 rw-p 00007000 fd:00 227777
| /usr/lib/R/library/RODBC/libs/RODBC.so
| 00756000-00757000 rw-p 00000000 00:00 0
| 0079a000-007cf000 r-xp 00000000 fd:00 17316      /lib/libreadline.so.6.0
| 007cf000-007d3000 rw-p 00035000 fd:00 17316      /lib/libreadline.so.6.0
| 007d3000-007d4000 rw-p 00000000 00:00 0
| 007d4000-0082a000 r-xp 00000000 fd:00 226761
| /usr/lib/R/library/stats/libs/stats.so
| 0082a000-0082c000 rw-p 00055000 fd:00 226761
| /usr/lib/R/library/stats/libs/stats.so
| 0088a000-00890000 r-xp 00000000 fd:00 225678
| /usr/lib/R/library/methods/libs/methods.so
| 00890000-00891000 rw-p 00005000 fd:00 225678
| /usr/lib/R/library/methods/libs/methods.so
| 00891000-008fd000 r-xp 00000000 fd:00 66770      /usr/lib/libodbc.so.2.0.0
| 008fd000-00902000 rw-p 0006b000 fd:00 66770      /usr/lib/libodbc.so.2.0.0
| 00921000-0092c000 r-xp 00000000 fd:00 31904      /lib/libnss_files-2.11.1.so
| 0092c000-0092d000 r--p 0000a000 fd:00 31904      /lib/libnss_files-2.11.1.so
| 0092d000-0092e000 rw-p 0000b000 fd:00 31904      /lib/libnss_files-2.11.1.so
| 00c33000-00c34000 r-xp 00000000 fd:00 10372      /usr/lib/gconv/ISO8859-1.so
| 00c34000-00c35000 r--p 00000000 fd:00 10372      /usr/lib/gconv/ISO8859-1.so
| 00c35000-00c36000 rw-p 00001000 fd:00 10372      /usr/lib/gconv/ISO8859-1.so
| 00e4d000-00e4e000 r-xp 00000000 00:00 0          [vdso]
| 00f3c000-00f64000 r-xp 00000000 fd:00 223584     /usr/lib/R/lib/libRblas.so
| 00f64000-00f65000 rw-p 00027000 fd:00 223584     /usr/lib/R/lib/libRblas.so
| 04c8d000-04d6a000 r-xp 00000000 fd:00 546
| /usr/lib/libstdc++.so.6.0.13
| 04d6a000-04d6e000 r--p 000dc000 fd:00 546
| /usr/lib/libstdc++.so.6.0.13
| 04d6e000-04d70000 rw-p 000e0000 fd:00 546
| /usr/lib/libstdc++.so.6.0.13
| 04d70000-04d76000 rw-p 00000000 00:00 0
| 04da8000-04dd7000 r-xp 00000000 fd:00 20052      /lib/libpcre.so.0.0.1
| 04dd7000-04dd8000 rw-p 0002e000 fd:00 20052      /lib/libpcre.so.0.0.1
| 050f6000-05106000 r-xp 00000000 fd:00 18599      /lib/libbz2.so.1.0.4
| 05106000-05107000 rw-p 00010000 fd:00 18599      /lib/libbz2.so.1.0.4
| 05109000-05112000 r-xp 00000000 fd:00 19476      /usr/lib/libltdl.so.7.2.1
| 05112000-05113000 rw-p 00008000 fd:00 19476      /usr/lib/libltdl.so.7.2.1
| 059e1000-05b9f000 r-xp 00000000 fd:00 13610      /usr/lib/libicui18n.so.42.1
| 05b9f000-05ba6000 rw-p 001be000 fd:00 13610      /usr/lib/libicui18n.so.42.1
| 05ba8000-05cf5000 r-xp 00000000 fd:00 20040      /usr/lib/libicuuc.so.42.1
| 05cf5000-05d00000 rw-p 0014c000 fd:00 20040      /usr/lib/libicuuc.so.42.1
| 05d00000-05d01000 rw-p 00000000 00:00 0
| 05dd6000-06d1b000 r-xp 00000000 fd:00 20039      /usr/lib/libicudata.so.42.1
| 06d1b000-06d1c000 rw-p 00f44000 fd:00 20039      /usr/lib/libicudata.so.42.1
| 08048000-08049000 r-xp 00000000 fd:00 223570     /usr/lib/R/bin/exec/R
| 08049000-0804a000 rw-p 00000000 fd:00 223570     /usr/lib/R/bin/exec/R
| 09d92000-0a90f000 rw-p 00000000 00:00 0          [heap]
| b74e9000-b755a000 rw-p 00000000 00:00 0
| b755a000-b755b000 rw-s 00000000 00:08 1146901    /SYSV79002790 (deleted)
| b755b000-b75fd000 rw-p 00000000 00:00 0
| b75fd000-b7604000 r--s 00000000 fd:00 942
| /usr/lib/gconv/gconv-modules.cache
| b7604000-b7649000 rw-p 00000000 00:00 0
| b7649000-b764a000 r--p 00000000 fd:00 227376
| /usr/share/R/locale/en/LC_MESSAGES/R.mo
| b764a000-b76be000 rw-p 00000000 00:00 0
| b76be000-b78be000 r--p 00000000 fd:00 56084
| /usr/lib/locale/locale-archive
| b78be000-b78c4000 rw-p 00000000 00:00 0
| bfc6e000-bfc8b000 rw-p 00000000 00:00 0          [stack]
| Aborted
| 
| *****
| Thanks in advance,

I cannot replicate this on Debian. The error gets trapped just fine. This may
be particular to your builds or setup. I don;t see an R error (but of course
do not speak for R Core). Here is a short version, it is the same in normal
interactive mode.

edd at ron:~> echo 'library(RODBC); channel <- odbcConnect("foo", uid="bar")' | R --slave
Warning messages:
1: In odbcDriverConnect("DSN=foo;UID=bar") :
  [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified
2: In odbcDriverConnect("DSN=foo;UID=bar") : ODBC connection failed
edd at ron:~> COLUMNS=78 dpkg -l r-base-core r-cran-rodbc | tail -2
ii  r-base-core    2.10.1-2       GNU R core of statistical computation and gr
ii  r-cran-rodbc   1.3-1-2        GNU R package for ODBC database access
edd at ron:~> ldd /usr/lib/R/site-library/RODBC/libs/RODBC.so 
	linux-gate.so.1 =>  (0xb80ca000)
	libodbc.so.1 => /usr/lib/libodbc.so.1 (0xb8043000)
	libR.so => /usr/lib/R/lib/libR.so (0xb7d2c000)
	libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7be4000)
	libltdl.so.7 => /usr/lib/libltdl.so.7 (0xb7bdc000)
	libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7bc3000)
	libblas.so.3gf => /usr/lib/atlas/libblas.so.3gf (0xb7848000)
	libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0xb7783000)
	libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb775c000)
	libreadline.so.6 => /lib/libreadline.so.6 (0xb7727000)
	libpcre.so.3 => /lib/libpcre.so.3 (0xb76f7000)
	libbz2.so.1.0 => /lib/libbz2.so.1.0 (0xb76e7000)
	libz.so.1 => /usr/lib/libz.so.1 (0xb76d3000)
	libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb76cf000)
	/lib/ld-linux.so.2 (0xb80cb000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb76b1000)
	libncurses.so.5 => /lib/libncurses.so.5 (0xb7679000)
edd at ron:~> 

Hth, Dirk
| 
| ~spot
| 
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Three out of two people have difficulties with fractions.



[Rd] Stack smashing in RODBC
Dirk Eddelbuettel