Bug 58035 - CRASH segfault from invalid SQL statement
Summary: CRASH segfault from invalid SQL statement
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
4.0.0.0.alpha0+ Master
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-09 00:42 UTC by Terrence Enger
Modified: 2013-03-31 04:14 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
typescript of gdb session (106.08 KB, text/plain)
2012-12-09 00:42 UTC, Terrence Enger
Details
typescript of valgrind run (230.54 KB, text/plain)
2012-12-09 15:30 UTC, Terrence Enger
Details
JRE error report (99.70 KB, text/plain)
2012-12-09 15:31 UTC, Terrence Enger
Details
3 bts (4.33 KB, application/bzip2)
2012-12-10 22:33 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terrence Enger 2012-12-09 00:42:30 UTC
Created attachment 71221 [details]
typescript of gdb session

This bug report arises from Olivier Ploton"s message to the dev list
"recent git master branch : crash instead of error popup"
<http://nabble.documentfoundation.org/recent-git-master-branch-crash-instead-of-error-popup-tp4023332.html>.
He says ...

    Launch libreoffice.
    Create a new database.
    Edit a new query inside SQL view.
    Type in some garbage, e.g.    xxxxxxxxx
    Run query.
    LO crashes.


I have reproduced this with master commit id 8450a99, fetched around
2012-12-09 02:00 UTC, configured with ...

    --enable-dbgutil
    --enable-crashdump
    --disable-build-mozilla
    --without-system-postgresql
    --without-myspell-dicts
    --without-help
    --with-extra-buildid

built and running on ubuntu-natty (11.04) 32-bit ...

    $ uname -a
    Linux cougar-natty 2.6.38-16-generic #67-Ubuntu SMP Thu Sep 6 18:00:43 UTC 2012 i686 athlon i386 GNU/Linux

    $ gcc --version
    gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
    Copyright (C) 2010 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    $ java -version
    java version "1.6.0_24"
    OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~11.04.1)
    OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)


In the attached typescript you will find
    line 161: SIGSEGV
    line 183: thread apply all backtrace
    line 451: backtrace full
    line 671: thread apply all backtrace full


A bug search turns up bug 47209 "In SQL mode in Queries, Base crashes
when a second SELECT followed by quotes is entered."  At first glance,
the backtrace there looks different from mine, and all the SQL
statements cited in the report are more comples than Olivier's.
Still, it could be the same problem.
Comment 1 Lionel Elie Mamane 2012-12-09 09:36:50 UTC
(In reply to comment #0)
> A bug search turns up bug 47209 "In SQL mode in Queries, Base crashes
> when a second SELECT followed by quotes is entered."  At first glance,
> the backtrace there looks different from mine, and all the SQL
> statements cited in the report are more comples than Olivier's.
> Still, it could be the same problem.

Bug 47209 can only be reproduced in NON debug builds.

This bug can only be reproduced in debug builds.

Looks like a different bug to me.
Comment 2 Julien Nabet 2012-12-09 15:22:49 UTC
Terrence: could you give a step by step process to reproduce this?
Comment 3 Terrence Enger 2012-12-09 15:30:11 UTC
Created attachment 71232 [details]
typescript of valgrind run

This valgrind output is dauntingly long.  Perhaps this extract from
toward the end is interesting ...

    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x169e16eb, pid=30891, tid=167998832
    #
    # JRE version: 6.0_24-b24
    # Java VM: OpenJDK Client VM (20.0-b12 interpreted mode linux-x86 )
    # Derivative: IcedTea6 1.11.5
    # Distribution: Ubuntu 11.04, package 6b24-1.11.5-0ubuntu1~11.04.1
    # Problematic frame:
    # C  [libdbulo.so+0x52f6eb]  com::sun::star::uno::Reference<com::sun::star::sdbc::SQLException>::~Reference()+0x19
    #
    # An error report file with more information is saved as:
    # /home/terry/lo_hacking/git/libo4/solver/unxlngi6/installation/opt/program/hs_err_pid30891.log
Comment 4 Terrence Enger 2012-12-09 15:31:48 UTC
Created attachment 71233 [details]
JRE error report
Comment 5 Terrence Enger 2012-12-09 17:02:54 UTC
To reporduce the problem ...

(1) In terminal ...

        rm      -rf "/tmp/New Datbase.odt"
        source  ./ooenv
        ./soffice.bin --base

    LibreOffice presents Database Wizard step 1 "Select Database" with
    "What do you want to do?" defaulted to "Create a new database".

(2) Click <Next>.  

    Program presents Database Wizard step 2 "Save and Proceed" with
    defaults "Yes, register the database for me" and "Open the
    database for editing".

(3) Click "No, do not register the database" and click <Finish>.

    The program presents dialog "Save as" with default File name "New
    Database1".

(4) Drag the mouse cursor through the default directory name.

    The program highlights the directory name.

(5) Type /tmp and <Enter>.

    The program displays contents of /tmp/.

(6) Click <Save>.

    The program closes "Save as", closes "Database Wizard" and
    displays window "New Database1.odb - LibreOffice Base [OOO410]"
    with <Tables> selected in the left frame.

(7) Click <Queries> in the left pane.

    Program changes the upper right pane "Tasks" to include three ways
    to create a query.

(8) In Tasks pane, click "Create Query in SQL View...".

    Program displays window "New Dababase1.odb : Query 1 - LibreOffice
    Base: Query Design [OOO410]".

(9) Type, without the quotes, "xxxxxxxx" and in the taskbar click the
    icon to run the query.

    Expected program action: message for syntax error in the query
    string.

    Actual program action: window "Due to an unexpected error,
    LibreOffice crashed. ...".
Comment 6 Julien Nabet 2012-12-09 17:36:55 UTC
Terrence: thank you for the precise step by step.
Badfully, on 4.0 branch (commit b4e305d778d153fa768a8c8cabd111efdd34c2fa), I don't reproduce the problem. (I've got the popup window "Syntax error...")

my autogen.lastrun
--with-system-odbc
#--enable-ext-mysql-connector
--with-system-mysql
--enable-ext-barcode
--enable-ext-diagram
--enable-ext-google-docs
--enable-ext-hunart
--enable-ext-nlpsolver
--enable-ext-ct2n
--enable-ext-numbertext
--enable-postgresql-sdbc
--enable-ext-presenter-minimizer
--enable-ext-report-builder
--enable-ext-typo
--enable-ext-validator
--enable-ext-watch-window
--enable-ext-wiki-publisher
--enable-dbus
--enable-graphite
--enable-evolution2
--enable-werror
--enable-debug
--enable-dbgutil
--enable-crashdump
--enable-dependency-tracking
--enable-online-update

master sources fail to build because of http://cgit.freedesktop.org/libreoffice/core/commit/?id=e1a91a9ceda6020bb256739e83dc371a50af3b1d. So I can't test it for the moment.
Comment 7 Julien Nabet 2012-12-10 22:33:58 UTC
Created attachment 71296 [details]
3 bts

With master sources updated today (commit 24f0aa76c005d1506a6d13945c39dafc6e9b8d91), I reproduced the crash.
I attached the bts I got.

I noticed these logs too:
warn:basic:6834:1:/home/julien/compile-libreoffice/libo/basic/source/uno/namecont.cxx:1219: Upgrade of Basic installation failed somehow: "Standard" not found
warn:legacy.osl:6834:1:/home/julien/compile-libreoffice/libo/vcl/unx/gtk/a11y/atkwrapper.cxx:813: OSL_ASSERT: xParent.is()

Not really sure there's a link.
Comment 8 Julien Nabet 2012-12-10 22:34:23 UTC
following my previous comment, put it at New.
Comment 9 Terrence Enger 2013-03-31 04:14:54 UTC
The problem seems to be gone in commit af17e2a, pulled around
2013-03-29 11:45 UTC.