bug fix for 'bad' data with odd number of UCS-2 bytes

This commit is contained in:
Brian Bruns 2016-08-30 08:52:32 -04:00
parent 23bab7c2d6
commit 9d56b0c3d8
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,9 @@
Tue Aug 30 08:51:31 EDT 2016 Brian Bruns <brian@bruns.com>
* bug fix for 'bad' data with odd number of UCS-2 bytes
Tue Aug 30 08:40:00 EDT 2016 Brian Bruns <brian@bruns.com>
* add LIMIT clause to SQL engine
Tue May 23 19:40:55 CDT 2006 Jeff Smith <whydoubt@yahoo.com>
* src/util/mdb-export.c: Fix typo in help text
* configure.in: Clean up use of autoconf macros

View File

@ -70,6 +70,13 @@ mdb_unicode2ascii(MdbHandle *mdb, char *src, size_t slen, char *dest, size_t dle
//printf("1 len_in %d len_out %d\n",len_in, len_out);
while (1) {
iconv(mdb->iconv_in, &in_ptr, &len_in, &out_ptr, &len_out);
/*
* Have seen database with odd number of bytes in UCS-2, shouldn't happen but protect against it
*/
if (!IS_JET3(mdb) && len_in<=1) {
//fprintf(stderr, "Detected invalid number of UCS-2 bytes\n");
break;
}
if ((!len_in) || (errno == E2BIG)) break;
/* Don't bail if impossible conversion is encountered */
in_ptr += (IS_JET3(mdb)) ? 1 : 2;