Bug #16300 | inserting with bind values makes assumptions about long size | ||
---|---|---|---|
Submitted: | 9 Jan 2006 13:12 | Modified: | 8 Mar 2007 1:31 |
Reporter: | tom hindle | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / ODBC | Severity: | S2 (Serious) |
Version: | 3.51.12 | OS: | IBM AIX (aix 5.2 64bit) |
Assigned to: | CPU Architecture: | Any |
[9 Jan 2006 13:12]
tom hindle
[27 Jul 2006 11:30]
tom hindle
Futher to my previous comments: A better change would be (if you want to be able to deal with 8 bits long's) length=int2str(getlong(data,cbValueMax),buff,-10,0) - buff; where getlong defined as: #define BITS 8 long getlong(void * data,int size) { long val=0; unsigned char * cptr=(char *)ptr; int i= size>sizeof(long)?sizeof(long):size; for (i=size-1;i>=0;i--) { val += (cptr[i] << (size-(size-i))*BITS); } return(val); }
[28 Aug 2006 20:42]
Sveta Smirnova
test case to recreate the error
Attachment: bug16300.c (text/x-csrc), 1.64 KiB.
[28 Aug 2006 20:46]
Sveta Smirnova
Thank you for the report. Verified as described on SuSe Linux using attached test case: ssmirnova@sles9-ia64:~> ./bug16300 Connecting to 'myodbc3' with user name 'root'... bug16300(11692): unaligned access to 0x60000fffffffadec, ip=0x2000000000062bd0
[8 Mar 2007 1:31]
Jim Winstead
cbValueMax should be ignored, as you can't specify the size of a SQL_C_LONG (it's always an SQLINTEGER).