[erlang-bugs] R15B02 odbcserver.c 64-bit bug

Joseph Wayne Norton norton@REDACTED
Thu Nov 1 06:37:38 CET 2012


We found a 64-bit bug with odbcserver.c while testing on CentOS6.2 with Oracle's ODBC client.

 - encode_out_params() is casting 32bit value of SQL_C_SLONG to 64bit --- ((long*)values).  It should be ((SQLINTEGER*)values).
 - encode_column_dyn() is doing similar encoding but correctly with SQLINTEGER(32bit) type.

We hope no one else has been silently bitten by this 64-bit bug.

regards,

Joe N.



--- ./otp_src_R15B02/lib/odbc/c_src/odbcserver.c.ORIG	2012-11-01 11:32:57.976934595 +0900
+++ ./otp_src_R15B02/lib/odbc/c_src/odbcserver.c	2012-11-01 11:35:03.248922917 +0900
@@ -1154,7 +1154,7 @@
					   (column.type.strlen_or_indptr_array[j]));
			break;
                case SQL_C_SLONG:
-                    ei_x_encode_long(&dynamic_buffer(state), ((long*)values)[j]);
+                   ei_x_encode_long(&dynamic_buffer(state), ((SQLINTEGER*)values)[j]);
                    break;
                case SQL_C_DOUBLE:
                    ei_x_encode_double(&dynamic_buffer(state),



$ cat /etc/redhat-release 
CentOS release 6.2 (Final)

$ uname -a
Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -q -a | grep oracle
oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64
oracle-instantclient11.2-odbc-11.2.0.3.0-1.x86_64

$ rpm -q -a | grep unix
unixODBC-2.2.14-11.el6.x86_64
unixODBC-devel-2.2.14-11.el6.x86_64

$ erl
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9.2  (abort with ^G)
1> 




More information about the erlang-bugs mailing list