[Home]

Summary:ASTERISK-16014: [patch] segfault caused by error in SQL
Reporter:David Ruggles (thedavidfactor)Labels:
Date Opened:2010-04-26 13:20:06Date Closed:2010-05-07 16:25:15
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20100426__issue17245.diff.txt
( 1) backtrace.txt
( 2) valgrind.txt
Description:Doing a very simple SQLite SQL query with an invalid SQL statement causes a segfault in asterisk. This was originally found in Asterisk 1.6.2.2 but has been confirmed in trunk. All attached files, unless otherwise noted, are based on trunk.

****** STEPS TO REPRODUCE ******

call the test extension in default context with the following config:

/etc/odbcinst.ini:
[SQLite]
Description     = ODBC for SQLite
Driver          = /usr/local/lib/libsqlite3odbc.so
Setup           = /usr/local/lib/libsqlite3odbc.so
Threading       = 2
#FileUsage      = 1

/etc/odbc.ini:
[testsqlite3]
Description = SQLite Test DB
Driver      = SQLite
Database    = /root/test.db
Timeout     = 2000
#Timeout     = 1000
#StepAPI     = No

res_odbc.conf:
[testsqlite3]
enabled => yes
dsn => testsqlite3
pooling => yes
limit => 10
pre-connect => yes

func_odbc.conf:
[TESTTABLE]
dsn=testsqlite3
writesql=INSERT INTO TESTTABLE (ID, DESCRIPTION) VALUES (${ARG1}, "${VAL1}")

extensions.conf:
[default]
exten => test,1,Set(ODBC_TESTTABLE(99)=SomeText) ; works
exten => test,n,Set(ODBC_TESTTABLE()=SomeOtherText) ; crashes Asterisk

****** ADDITIONAL INFORMATION ******

inital valgrind.txt is attached.
Comments:By: David Ruggles (thedavidfactor) 2010-04-26 13:25:24

This has been confirmed.

By: David Ruggles (thedavidfactor) 2010-04-26 13:57:00

The patch provided by tilghman is ready for testing.

By: Tilghman Lesher (tilghman) 2010-05-06 15:10:40

David:  you reported this.  Were you planning on testing it?

By: David Ruggles (thedavidfactor) 2010-05-06 15:16:24

I reported on behalf of another user after verifying the error myself. I don't have this problem in production so I've asked that user to test and updated this issue. I haven't heard back from them yet.

By: Murray Melvin (murraytm) 2010-05-07 14:22:56

I have done some light testing with this on 1.6.2.7 and verified that the segfault is gone in the situations where I had it before.

By: Digium Subversion (svnbot) 2010-05-07 15:54:35

Repository: asterisk
Revision: 261917

U   trunk/funcs/func_odbc.c

------------------------------------------------------------------------
r261917 | tilghman | 2010-05-07 15:54:35 -0500 (Fri, 07 May 2010) | 8 lines

Double free crash

(closes issue ASTERISK-16014)
Reported by: thedavidfactor
Patches:
      20100426__issue17245.diff.txt uploaded by tilghman (license 14)
Tested by: murraytm

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=261917

By: Digium Subversion (svnbot) 2010-05-07 16:25:14

Repository: asterisk
Revision: 261947

_U  branches/1.6.2/
U   branches/1.6.2/funcs/func_odbc.c

------------------------------------------------------------------------
r261947 | tilghman | 2010-05-07 16:25:14 -0500 (Fri, 07 May 2010) | 15 lines

Merged revisions 261917 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r261917 | tilghman | 2010-05-07 15:54:35 -0500 (Fri, 07 May 2010) | 8 lines
 
 Double free crash
 
 (closes issue ASTERISK-16014)
  Reported by: thedavidfactor
  Patches:
        20100426__issue17245.diff.txt uploaded by tilghman (license 14)
  Tested by: murraytm
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=261947