Commit Graph

456 Commits

Author SHA1 Message Date
Evan Miller
38ce7db045 Large file support on 32-bit systems
* Add AC_SYS_LARGEFILE to configure.ac

* Replace fseek with fseeko
2020-11-07 11:40:44 -05:00
James Woodcock
42996dad65 Send error message to stderr 2020-11-01 12:56:38 +00:00
James Woodcock
de4f5516b7 Handle errors from mdb_bind_column() 2020-10-31 09:46:00 +00:00
James Woodcock
50f1bd4a86 Return column number from mdb_bind_column()
To match the return from mdb_bind_column_by_name().
2020-10-31 09:40:24 +00:00
James Woodcock
2e8480d7e5 Merge branch 'dev' of https://github.com/mdbtools/mdbtools into bounds-check-mdb-bind-column 2020-10-31 09:38:03 +00:00
Rainer Hurling
5b292e0063 Unsigned error in index.c
On FreeBSD 13.0-CURRENT its compiler clang-11.0.0 complains:
index.c:388:14: error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare]
                for (i=0; i<len+1; i++) {
                          ~^~~~~~
2020-10-24 20:29:46 +02:00
James Woodcock
a7885f2680 Bounds check mdb_bind_column()
Return -1 to report out of bounds column number.
2020-10-24 13:27:34 +01:00
James Woodcock
9bf70e0e1e mdb-export: use sensible date formats 2020-10-24 09:41:39 +01:00
Evan Miller
131b443102 Do not exit from library 2020-10-18 09:45:51 -04:00
Evan Miller
9f41e03278 Fix up libtool version-info logic 2020-09-05 10:50:24 -04:00
Evan Miller
6e08ad5ae9 Add copyright info for fakeglib 2020-09-05 10:49:56 -04:00
Evan Miller
7f7761e884 Improved support for "Short Date" fields
* Separate -D (date only) and -T (date/time) format options in mdb-export and mdb-json

* New public mdb_set_shortdate_fmt() function in libmdb

* New private(ish) mdb_col_is_shortdate() function

I'm calling it "shortdate" in order to preserve the existing API.

See https://github.com/mdbtools/mdbtools/issues/12
2020-09-02 22:14:57 -04:00
Evan Miller
a13936bd77 Support comparisons with MDB_FLOAT and MDB_DOUBLE
See https://github.com/mdbtools/mdbtools/issues/105
2020-09-02 21:24:24 -04:00
Evan Miller
aa0ce8fb3e Consolidate print_col functions into backend.c 2020-09-02 20:38:15 -04:00
Evan Miller
7b5d547acf Merge branch 'mysql-comments' of github.com:mdbtools/mdbtools into merge-164 2020-09-02 15:48:29 -04:00
Evan Miller
0fb33c2eb6 Fix prototype error with GCC 2020-09-02 15:07:13 -04:00
Evan Miller
9f23385a8c New mdb_get_version() function
See https://github.com/mdbtools/mdbtools/issues/138
2020-09-02 14:55:32 -04:00
Evan Miller
fb960553e6 New mdb_set_bind_size function overrides MDB_BIND_SIZE
This should fix long-standing complaints about the default bind size
without causing undue memory inflation in existing applications.

Could make this adjustable on the command line later.

Supersedes:

https://github.com/mdbtools/mdbtools/pull/137
2020-09-02 14:30:07 -04:00
Evan Miller
cea7553e00 Export fakeglib symbols from main library 2020-08-31 13:27:08 -04:00
Evan Miller
be888e0dd7 Support fuzz testing (#4)
Quickstart (requires Clang 6 or later):

$ export LIB_FUZZING_ENGINE=/path/to/fuzzing/library.a
$ ./configure --enable-fuzz-testing
$ make
$ cd src/fuzz
$ make fuzz_mdb
$ ./fuzz_mdb

Also add a new `mdb_open_buffer function` to facilitate in-memory
fuzz-testing. This requires fmemopen, which may not be present on all
systems. The internal API has been reworked to use file streams instead
of file descriptors. This allows reading from memory and reading from
files using a consistent API.
2020-08-31 13:03:58 -04:00
Evan Miller
a08dab706e Fix crash in previous commit 2020-08-21 08:53:05 -04:00
Evan Miller
2ee83971fa Clean up mdb_clone_handle 2020-08-20 21:57:25 -04:00
Evan Miller
4d443840cb Try to fix a crash 2020-08-20 21:31:38 -04:00
Evan Miller
09c497bffd Fix double free with backend dictionary 2020-08-20 20:10:51 -04:00
Evan Miller
6d7a5c79af Merge branch 'master' into backend-thread-safety 2020-08-20 19:53:29 -04:00
Evan Miller
e743949e47 Change char * to const char * 2020-08-20 15:46:06 -04:00
Evan Miller
f668f25d99 Use GCC struct initializers for clarity 2020-08-20 15:37:05 -04:00
Evan Miller
b36f2bff1d Merge branch 'master' into backend-thread-safety 2020-08-20 15:22:52 -04:00
Evan Miller
90ee7bfcb5 Remove references to dmalloc
There are more modern tools for memory debugging, get rid of DMALLOC
crap in the source code.

I've left one reference in backend.c to prevent a merge conflict but
this can be removed later.
2020-08-20 08:59:08 -04:00
Evan Miller
452cd29343 Get rid of more static memory
* Replace backend_is_init (formerly is_init) with relationships_table

* Remove deprecated functions that used static variables

* Move static "bound" variable to MdbHandle as relationships_values
2020-08-20 08:47:13 -04:00
Evan Miller
588663675e Move backend dictionary and state to MdbHandle
Attempt to make the backend handling logic thread-safe. This removes the
last MDB_CONSTRUCTOR. Also get rid of some JAVA junk and make the
remaining static variables in backend.c constant. Finally remove some
obsolete fields from MdbFile.
2020-08-20 07:58:53 -04:00
Evan Miller
5d078838ed [API break] Make date/boolean formats thread safe
Store the preferred date and boolean formats in the MdbHandle rather
than in global memory.
2020-08-19 21:26:06 -04:00
Evan Miller
7b51824c89 Consolidate / fix UUID formatting 2020-08-19 20:53:35 -04:00
Evan Miller
9020ca9a1e Attempt to make the ODBC driver thread-safe
I'm not sure if this is a complete solution - some of the global state
has been moved to thread-local storage. So passing an ODBC handle across
threads may have unexpected results. But at least it's not global state.

Each ODBC handle now has its own iconv_t object.

See #23
2020-08-19 15:35:02 -04:00
Evan Miller
1ad0dd2d8b Simplify code 2020-08-18 21:20:40 -04:00
Nyall Dawson
6085a89e1d Use ICONV_CONST 2020-08-13 12:42:32 +10:00
Nyall Dawson
1846fab4e6 Const correctness on src char pointers for unicode/ascii conversion 2020-08-13 12:12:52 +10:00
Nyall Dawson
277b49f209 More warning fixes 2020-08-12 13:11:52 +10:00
Nyall Dawson
1639283779 Fix int/guint comparison warnings 2020-08-12 13:04:20 +10:00
Evan Miller
4ca16b8edf Fix bug in fake g_strsplit
Lack of NULL termination caused an occasional crash
2020-08-10 16:58:11 -04:00
Evan Miller
3c7761f965 Support --disable-glib flag with ODBC driver 2020-08-10 15:58:22 -04:00
Evan Miller
82bbc0cef7 Improved bounds checking 2020-08-09 16:38:25 -04:00
Evan Miller
7690ef376f Turn off -Wsign-compare for the lexer
Flex doesn't like it.
2020-08-09 16:23:06 -04:00
Evan Miller
c93156626c Fix all sign-compare warnings
Also flip on -Wsign-compare in the default configuration
2020-08-09 16:15:20 -04:00
Evan Miller
e7782f7821 Remove debugging comments from mdb-schema 2020-08-06 23:18:05 -04:00
Evan Miller
2e6e88b96f Improve bounds and return-value checking
Fixes a memory leak and a number of buffer overruns
2020-08-06 15:17:04 -04:00
Evan Miller
b01c4b8941 Check result of mdb_find_pg_row / fix crash 2020-08-06 14:14:32 -04:00
Evan Miller
4682ec0f8a Fix crash 2020-08-06 14:08:30 -04:00
Evan Miller
272bd191bc Merge branch 'master' into no-glib 2020-08-06 12:51:52 -04:00
Evan Miller
9b6b52cc8c Fix buffer overflow in mdb_numeric_to_string brianb/mdbtools#124 2020-08-06 12:34:09 -04:00