Bug 253825 - Qt application with unixODBC terminates with message *** buffer overflow detected ***
Qt application with unixODBC terminates with message *** buffer overflow dete...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: unixODBC (Show other bugs)
10
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Tom Lane
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-22 04:13 EDT by jcmvbkbc
Modified: 2013-07-02 23:14 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-12-18 00:58:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
patch that works for me (1.51 KB, patch)
2007-08-22 05:59 EDT, jcmvbkbc
no flags Details | Diff

  None (edit)
Description jcmvbkbc 2007-08-22 04:13:37 EDT
Description of problem:

Qt application with unixODBC terminates with message
*** buffer overflow detected ***
when fetching double precision values from postgreSQL
when environment variable LANG=ru_RU.utf8 (actually, when LANG!=C)

Version-Release number of selected component (if applicable):

unixODBC-2.2.12-2.fc7

How reproducible:

postgresql data source (in terms of ODBC) required. assuming one named "a":

Steps to Reproduce:
1. launch odbctest
2. Env -> SQLAllocEnv -> Ok
3. Conn -> SQLAllocConnect -> Ok
4. Conn -> SQLConnect -> fill 'a' (i.e. data source name, without quotes) 
in 'Server' field -> Ok
5. Stmt -> SQLAllocStmt -> Ok
6. Stmt -> SQLExecDirect -> fill 'select 1.5 as a;' (without quotes) in 'SQL 
Text' field -> Ok
7. Results -> SQLFetch -> Ok
8. Results -> SQLGetData -> select 'SQL_C_DOUBLE' in 'Target Type' field -> Ok

Actual results:

odbctest termination with message

[dumb@octofox ~]$ odbctest
*** buffer overflow detected ***: odbctest terminated
======= Backtrace: =========
/lib/libc.so.6(__chk_fail+0x41)[0xc73bb1]
/lib/libc.so.6(__strcpy_chk+0x43)[0xc730c3]
/usr/lib/libodbcpsql.so(copy_and_convert_field+0xb1a)[0x43769a]
/usr/lib/libodbcpsql.so(PG_SQLGetData+0x2a5)[0x44ab45]
/usr/lib/libodbcpsql.so(SQLGetData+0x42)[0x44ad52]
/usr/lib/libodbc.so.1(SQLGetData+0x17d)[0x20fffd]
odbctest[0x807e861]
odbctest[0x8107888]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN7QObject15activate_signalEP15QConnectionListP8QUObject+0xd1)[0x631dc81]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN7QObject15activate_signalEi+0xbd)
[0x631e70d]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN7QButton7clickedEv+0x2c)[0x66b40cc]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN7QButton17mouseReleaseEventEP11QMouseEvent+0xbd)[0x63c26ad]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN7QWidget5eventEP6QEvent+0x3c5)[0x635a3b5]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN12QApplication14internalNotifyEP7QObjectP6QEvent+0x9b)[0x62b453b]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x269)[0x62b5d09]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN9QETWidget19translateMouseEventEPK7_XEvent+0x576)[0x624b996]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN12QApplication15x11ProcessEventEP7_XEvent+0x8e6)[0x624a766]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop13processEventsEj+0x4eb)
[0x625c38b]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop9enterLoopEv+0x50)[0x62cde30]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN12QApplication10enter_loopEv+0x1f)
[0x62b40ef]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN7QDialog4execEv+0x75)[0x64c8fc5]
odbctest[0x8081138]
odbctest[0x810bf2e]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN7QObject15activate_signalEP15QConnectionListP8QUObject+0x16a)[0x631dd1a]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN7QSignal6signalERK8QVariant+0x8e)
[0x66abfce]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN7QSignal8activateEv+0x77)[0x633c2e7]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN10QPopupMenu17mouseReleaseEventEP11QMouseEvent+0x475)[0x643e195]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN7QWidget5eventEP6QEvent+0x3c5)[0x635a3b5]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN12QApplication14internalNotifyEP7QObjectP6QEvent+0x9b)[0x62b453b]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x269)[0x62b5d09]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN9QETWidget19translateMouseEventEPK7_XEvent+0xf40)[0x624c360]
/usr/lib/qt-3.3/lib/libqt-mt.so.3
(_ZN12QApplication15x11ProcessEventEP7_XEvent+0x8e6)[0x624a766]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop13processEventsEj+0x4eb)
[0x625c38b]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop9enterLoopEv+0x50)[0x62cde30]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN10QEventLoop4execEv+0x26)[0x62cdce6]
/usr/lib/qt-3.3/lib/libqt-mt.so.3(_ZN12QApplication4execEv+0x1f)[0x62b417f]
odbctest[0x8099e15]
/lib/libc.so.6(__libc_start_main+0xe0)[0xba4f70]
odbctest(_ZN9QTextEdit13setWrapPolicyENS_10WrapPolicyE+0x45)[0x8053871]
======= Memory map: ========
00110000-00111000 r-xp 00110000 00:00 0          [vdso]
00111000-0011b000 r-xp 00000000 08:11 65061      /lib/libnss_files-2.6.so
0011b000-0011c000 r-xp 00009000 08:11 65061      /lib/libnss_files-2.6.so
0011c000-0011d000 rwxp 0000a000 08:11 65061      /lib/libnss_files-2.6.so
0011d000-00121000 r-xp 00000000 08:11 
1984128    /usr/lib/qt-3.3/plugins/inputmethods/libqimsw-none.so
00121000-00122000 rwxp 00003000 08:11 
1984128    /usr/lib/qt-3.3/plugins/inputmethods/libqimsw-none.so
00124000-0014b000 r-xp 00000000 08:11 
1720257    /usr/lib/libfontconfig.so.1.2.0
0014b000-00153000 rwxp 00027000 08:11 
1720257    /usr/lib/libfontconfig.so.1.2.0
00155000-0017a000 r-xp 00000000 08:11 1720176    /usr/lib/libpng12.so.0.16.0
0017a000-0017b000 rwxp 00024000 08:11 1720176    /usr/lib/libpng12.so.0.16.0
0017d000-0017f000 r-xp 00000000 08:11 1722025    /usr/lib/libXinerama.so.1.0.0
0017f000-00180000 rwxp 00001000 08:11 1722025    /usr/lib/libXinerama.so.1.0.0
00182000-00186000 r-xp 00000000 08:11 1722028    /usr/lib/libXfixes.so.3.1.0
00186000-00187000 rwxp 00003000 08:11 1722028    /usr/lib/libXfixes.so.3.1.0
00189000-00191000 r-xp 00000000 08:11 1722026    /usr/lib/libXi.so.6.0.0
00191000-00192000 rwxp 00007000 08:11 1722026    /usr/lib/libXi.so.6.0.0
00194000-0019d000 r-xp 00000000 08:11 1722029    /usr/lib/libXcursor.so.1.0.2
0019d000-0019e000 rwxp 00008000 08:11 1722029    /usr/lib/libXcursor.so.1.0.2
001a0000-001a6000 r-xp 00000000 08:11 1722027    /usr/lib/libXrandr.so.2.1.0
001a6000-001a7000 rwxp 00005000 08:11 1722027    /usr/lib/libXrandr.so.2.1.0
001a9000-001b1000 r-xp 00000000 08:11 1722034    /usr/lib/libSM.so.6.0.0
001b1000-001b2000 rwxp 00007000 08:11 1722034    /usr/lib/libSM.so.6.0.0
001b2000-001bb000 r-xp 00000000 08:11 
1984127    /usr/lib/qt-3.3/plugins/inputmethods/libqimsw-multi.so
001bb000-001bc000 rwxp 00008000 08:11 
1984127    /usr/lib/qt-3.3/plugins/inputmethods/libqimsw-multi.so
001be000-001d9000 r-xp 00000000 08:11 64842      /lib/ld-2.6.so
001d9000-001da000 r-xp 0001a000 08:11 64842      /lib/ld-2.6.so
001da000-001db000 rwxp 0001b000 08:11 64842      /lib/ld-2.6.so
001dd000-001f1000 r-xp 00000000 08:11 1724001    /usr/lib/libodbcinst.so.1.0.0
001f1000-001f2000 rwxp 00013000 08:11 1724001    /usr/lib/libodbcinst.so.1.0.0
001f4000-00263000 r-xp 00000000 08:11 1729761    /usr/lib/libodbc.so.1.0.0
00263000-00268000 rwxp 0006e000 08:11 1729761    /usr/lib/libodbc.so.1.0.0
00268000-00287000 r-xp 00000000 08:11 64864      /lib/libexpat.so.0.5.0
00287000-00289000 rwxp 0001e000 08:11 64864      /lib/libexpat.so.0.5.0
00289000-002a8000 r-xp 00000000 08:11 
2334214    /usr/lib/kde3/plugins/styles/plastik.so
002a8000-002a9000 rwxp 0001f000 08:11 
2334214    /usr/lib/kde3/plugins/styles/plastik.so
002a9000-002d3000 r-xp 00000000 08:11 1722109    /usr/lib/libkdefx.so.4.2.0
002d3000-002d4000 rwxp 0002a000 08:11 1722109    /usr/lib/libkdefx.so.4.2.0
002d4000-002f8000 r-xp 00000000 08:11 
1984129    /usr/lib/qt-3.3/plugins/inputmethods/libqsimple.so
002f8000-002f9000 rwxp 00023000 08:11 
1984129    /usr/lib/qt-3.3/plugins/inputmethods/libqsimple.so
002f9000-00303000 r-xp 00000000 08:11 
1984132    /usr/lib/qt-3.3/plugins/inputmethods/libqxim.so
00303000-00304000 rwxp 0000a000 08:11 
1984132    /usr/lib/qt-3.3/plugins/inputmethods/libqxim.so
00304000-00305000 r-xp 00000000 08:11 1783842    /usr/lib/gconv/ISO8859-1.so
00305000-00307000 rwxp 00000000 08:11 1783842    /usr/lib/gconv/ISO8859-1.so
00307000-0031c000 r-xp 00000000 08:11 64884      /lib/libnsl-2.6.so
0031c000-0031d000 r-xp 00014000 08:11 64884      /lib/libnsl-2.6.so
0031d000-0031e000 rwxp 00015000 08:11 64884      /lib/libnsl-2.6.so
0031e000-00320000 rwxp 0031e000 00:00 0
0033d000-0036e000 r-xp 00000000 08:11 1722048    /usr/lib/liblcms.so.1.0.16
0036e000-0036f000 rwxp 00031000 08:11 1722048    /usr/lib/liblcms.so.1.0.16
0036f000-00372000 rwxp 0036f000 00:00 0
00379000-0038b000 r-xp 00000000 08:11 1722050    /usr/lib/libXft.so.2.1.2
0038b000-0038c000 rwxp 00012000 08:11 1722050    /usr/lib/libXft.so.2.1.2
003be000-00426000 r-xp 00000000 08:11 1722049    /usr/lib/libmng.so.1.0.0
00426000-00429000 rwxp 00067000 08:11 1722049    /usr/lib/libmng.so.1.0.0
00429000-0046a000 r-xp 00000000 08:11 1738344    /usr/lib/libodbcpsql.so.2.0.0
0046a000-0046c000 rwxp 00040000 08:11 1738344    /usr/lib/libodbcpsql.so.2.0.0
0046c000-0049e000 rwxp 0046c000 00:00 0
00b8f000-00cdd000 r-xp 00000000 08:11 64844      /lib/libc-2.6.so
00cdd000-00cdf000 r-xp 0014e000 08:11 64844      /lib/libc-2.6.so
00cdf000-00ce0000 rwxp 00150000 08:11 64844      /lib/libc-2.6.so
00ce0000-00ce3000 rwxp 00ce0000 00:00 0
00ce5000-00d0c000 r-xp 00000000 08:11 64862      /lib/libm-2.6.so
00d0c000-00d0d000 r-xp 00026000 08:11 64862      /lib/libm-2.6.so
00d0d000-00d0e000 rwxp 00027000 08:11 64862      /lib/libm-2.6.so
00d10000-00d13000 r-xp 00000000 08:11 64849      /lib/libdl-2.6.so
00d13000-00d14000 r-xp 00002000 08:11 64849      /lib/libdl-2.6.so
00d14000-00d15000 rwxp 00003000 08:11 64849      /lib/libdl-2.6.so
00d17000-00d29000 r-xp 00000000 08:11Аварийный останов


Expected results:

message
SQLGetData():
  In:
    Statement Handle: 0x8608be8
    Column Number: 1
    Target Type: SQL_C_DOUBLE=8 (1.0)
    Target Value Ptr: 0x8607658
    Buffer Length: 300
    Strlen_or_Ind Ptr: 0xbfce97e0
  Return:
    SQL_SUCCESS=0
  Out:
    *Strlen_or_Ind Ptr: 8
    *Target Value Ptr: 1.500000

in odbctest window after step 8

Additional info:

short investigation revealed

char saved_locale[256];

at the beginning of copy_and_convert_fields of both 
unixODBC-2.2.12/Drivers/PostgreSQL/convert.c and
unixODBC-2.2.12/Drivers/Postgre7.1/convert.c

after increasing buffer size to 4096 it works for me. maybe alloca() would be 
better. however, I cannot rebuild source rpm.
Comment 1 jcmvbkbc 2007-08-22 05:59:13 EDT
Created attachment 162042 [details]
patch that works for me
Comment 2 Bug Zapper 2008-05-14 10:04:36 EDT
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:
http://docs.fedoraproject.org/release-notes/

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Bug Zapper 2008-11-25 20:58:33 EST
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 4 Bug Zapper 2009-11-18 05:07:48 EST
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 5 Bug Zapper 2009-12-18 00:58:01 EST
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.