Bug 396984 - Possible crash when importing MDB file having non-latin characters in column names
Summary: Possible crash when importing MDB file having non-latin characters in column ...
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Migration/Import/Export (show other bugs)
Version: 3.1.0
Platform: Other All
: NOR crash
Target Milestone: ---
Assignee: Jarosław Staniek
URL: https://phabricator.kde.org/D14486
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-30 13:59 UTC by Jarosław Staniek
Modified: 2023-09-03 20:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.2.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jarosław Staniek 2018-07-30 13:59:10 UTC
Possible crash when importing MDB file having non-latin characters in column names

Test: Import MDB file aving non-latin characters in at least one column name (I'll try to prepare small test file later). 

Atual result: Crash on import. Not all cases cause but name such as "nid4U4-05_Disciplina_MédiaUnid4U4-06_Disci" (not the é character) in a private file provided by a user causes such a crash.
Expected: All tables properly import with data.

Backtrace:
1   mdb_unicode2ascii                                 iconv.c                    81   0x7fffae73b69f 
2   mdb_read_columns                                  table.c                    307  0x7fffae740431 
3   KexiMigration::MDBMigrate::getPrimaryKey          mdbmigrate.cpp             389  0x7fffae734838 
4   KexiMigration::MDBMigrate::drv_readTableSchema    mdbmigrate.cpp             183  0x7fffae733f45 
5   KexiMigration::KexiMigrate::performImportInternal keximigrate.cpp            459  0x7fffc97beada 
6   KexiMigration::KexiMigrate::performImport         keximigrate.cpp            367  0x7fffc97be0b0 
7   KexiMigration::ImportWizard::import               importwizard.cpp           890  0x7fffc97d5cc1 
8   KexiMigration::ImportWizard::next                 importwizard.cpp           1028 0x7fffc97d6db1 
9   QtPrivate::QSlotObjectBase::call                  qobjectdefs_impl.h         376  0x7ffff325ec13 
10  QMetaObject::activate                             qobject.cpp                3754 0x7ffff325ec13 
11  QMetaObject::activate                             qobject.cpp                3633 0x7ffff325f227 
12  QAbstractButton::clicked                          moc_qabstractbutton.cpp    308  0x7ffff4c0fcd2 
13  QAbstractButtonPrivate::emitClicked               qabstractbutton.cpp        414  0x7ffff4c0feda 
14  QAbstractButtonPrivate::click                     qabstractbutton.cpp        407  0x7ffff4c113d3 
15  QAbstractButton::mouseReleaseEvent                qabstractbutton.cpp        1011 0x7ffff4c11545 
16  QWidget::event                                    qwidget.cpp                8901 0x7ffff4b67c87 
17  QApplicationPrivate::notify_helper                qapplication.cpp           3728 0x7ffff4b2c1ac 
18  QApplication::notify                              qapplication.cpp           3204 0x7ffff4b33718 
19  QCoreApplication::notifyInternal2                 qcoreapplication.cpp       1048 0x7ffff32348f5 
20  QCoreApplication::sendEvent                       qcoreapplication.h         234  0x7ffff4b321e9 
21  QApplicationPrivate::sendMouseEvent               qapplication.cpp           2696 0x7ffff4b321e9 
22  QWidgetWindow::handleMouseEvent                   qwidgetwindow.cpp          659  0x7ffff4b8049f 
23  QWidgetWindow::event                              qwidgetwindow.cpp          280  0x7ffff4b82993 
24  QApplicationPrivate::notify_helper                qapplication.cpp           3728 0x7ffff4b2c1ac 
25  QApplication::notify                              qapplication.cpp           3487 0x7ffff4b32b52 
26  QCoreApplication::notifyInternal2                 qcoreapplication.cpp       1048 0x7ffff32348f5 
27  QCoreApplication::sendSpontaneousEvent            qcoreapplication.h         237  0x7ffff3a6174f 
28  QGuiApplicationPrivate::processMouseEvent         qguiapplication.cpp        2081 0x7ffff3a6174f 
29  QGuiApplicationPrivate::processWindowSystemEvent  qguiapplication.cpp        1816 0x7ffff3a63855 
30  QWindowSystemInterface::sendWindowSystemEvents    qwindowsysteminterface.cpp 1032 0x7ffff3a427eb 
... <More>
Comment 2 Jarosław Staniek 2018-07-30 14:02:37 UTC
Actual bug fix in mdbtools upstream: https://github.com/brianb/mdbtools/commit/9d56b0c3d80cdabc21bc4af0f9bba849b24035f0.

We're combining the fix with complete merge with current mdbtools update.
Comment 3 Jarosław Staniek 2018-08-30 21:24:42 UTC
Git commit 08ac1466f449097300b4a7b7d62fdc2b78a9a7a0 by Jaroslaw Staniek.
Committed on 30/08/2018 at 21:04.
Pushed by staniek into branch '3.1'.

Update to current mdbtools

(Merge branch 'D14486' into 3.1)

Summary:
FIXED-IN:3.1.1

Bug fixes relevant to KEXI:
- Fix crash on importing zero length memos (long text)
- Fix not being able to handle binary objects larger than 16 MiB. Limit is now 256 MiB.
- Fix possible crash when importing MDB file having non-latin characters in column names of unexpected length

Details:
- GIT_SILENT Fix typos
mdbtools 9fb36c0f075de 772b5675dd98bda

- Segfault fix on memo zero length multiple page
While converting memo field to string, stop processing on zero length multiple
page. mdbtools a89baeacf5976daf196

- Fix binary output
Closes issue #44. mdbtools 9ab40e83e6789015c965

- Introduce MDB_BACKEND_* enum
mdbtools cce6cfead2377ae7d

- Fix for dates in mdb-props
mdbtools a3ab6c7969ee379e2393f

- Allow CFLGAS="-std=c99 -D_POSIX_C_SOURCE=2"
Use glib function:
strcasecmp -> g_ascii_strcasecmp
bzero -> memset
strdup -> g_strdump
Don't use arithmetic void*+int
mdbtools 2a70e16a8b943b25bc

- Avoid dynamic array allocation on stack.
This might help some non C99 compliant compilers, while being a trivial change.
mdbtools 9b4d5e624b4e16fd1097

- Compiles with VC++ as a .dll. Set up to use static glib, libiconv, libintl for ease of use.
mdbtools cb65d4f3ddd5d95261

- Fix warnings mostly related unsigned char after merging mdbtools cb65d4f3ddd5d952

- Fix not being able to handle blobs > 16 MB. Limit now at 256 MB
mdbtools 850d9e169d91bda02

- JET 4: index flags (eg, UNIQUE) 4 bytes later.
Re-reverse engineered index meta information layout in JET 4
file format, based particularly on jackcess (Java) JET/Access
database library (https://github.com/jahlborn/jackcess), and
hexdumps of JET 4 database index meta information.  Based both
on byte counting of jackcess reading of index definitions and
also expected flag values (0x80, 0x89, etc), the flags of JET 4
index definition are 4 bytes later than mdbtools previously thought.
See IndexData.read() and private static class Jet4Format in
src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java
src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java
in jackcess source for layout reference.
Now appears to get sensible "CREATE INDEX"/"CREATE UNIQUE INDEX"
behaviour on export to PostgreSQL schema.
Also added extensive index definition byte layout reference to top
of src/libmdb/index.c for ease of reference, plus more debugging
assistance (and comments of phases reading index for readability).
mdbtools 999f6f5f104393f77

- mdb-export: Add boolean words option (TRUE/FALSE)
Adds "-B" (--boolean-words) option to mdb-export, which will reconfigure
mdb/data.c to export TRUE/FALSE for boolean values instead of 1/0.  The
option is needed to support BOOLEAN fields on PostgreSQL, which will not
implicitly cast bare 1/0 into a BOOLEAN value.  Value literals are the
SQL TRUE/FALSE, and _quoted_ words meaning true/false and _quoted_
'1'/'0'.  With this flag the SQL TRUE/FALSE values are output, which should
work with several SQL databases.
PostgreSQL Reference: http://www.postgresql.org/docs/current/static/datatype-boolean.html
(note for KEXI: note used but added to make data.c merges more cleanly)
mdbtools 8b1db6c08edbdf

- At least for me IS NULL and IS NOT NULL are the wrong way round in SQL, fixed it.
mdbtools 2355aec912724a2

- bug fix for 'bad' data with odd number of UCS-2 bytes (fixes BUG:396984 in KEXI)
mdbtools 9d56b0c3d80cdabc21b

Test Plan: See description of https://bugs.kde.org/show_bug.cgi?id=396984

Reviewers: piggz

Reviewed By: piggz

Subscribers: anthonyfieroni, pino, Kexi-Devel-list

Tags: #kexi

Maniphest Tasks: T1361

Differential Revision: https://phabricator.kde.org/D14486


https://commits.kde.org/kexi/08ac1466f449097300b4a7b7d62fdc2b78a9a7a0
Comment 4 Jarosław Staniek 2018-08-30 21:24:45 UTC
Git commit 410db4e376239bdf491e2fdf834b2ef04d78d052 by Jaroslaw Staniek, on behalf of Brian Bruns.
Committed on 30/08/2018 at 21:02.
Pushed by staniek into branch '3.1'.

Bug fix for 'bad' data with odd number of UCS-2 bytes
mdbtools 9d56b0c3d80cdabc21b

M  +7    -0    src/migration/mdb/3rdparty/mdbtools/libmdb/iconv.c

https://commits.kde.org/kexi/410db4e376239bdf491e2fdf834b2ef04d78d052