diff options
author | unknown <tomas@whalegate.ndb.mysql.com> | 2007-06-14 12:51:13 +0200 |
---|---|---|
committer | unknown <tomas@whalegate.ndb.mysql.com> | 2007-06-14 12:51:13 +0200 |
commit | 28444ac8b157fa2db16a886b2eb462161a73c97d (patch) | |
tree | b12b40885d7db59eca4d28d94baeee8a5489882f /storage/ndb/tools | |
parent | ef3ed50bc0be1170cf22bcdc914374b3a1a67407 (diff) | |
download | mariadb-git-28444ac8b157fa2db16a886b2eb462161a73c97d.tar.gz |
Bug #29103 ndb_restore segfaults on NULL var[char|binary]
mysql-test/r/ndb_restore.result:
Bug #29103 ndb_restore segfaults on NULL var[char|binary]
- add extra row with NULL value to test
mysql-test/t/ndb_restore.test:
Bug #29103 ndb_restore segfaults on NULL var[char|binary]
- add extra row with NULL value to test
storage/ndb/tools/restore/consumer_restore.cpp:
Bug #29103 ndb_restore segfaults on NULL var[char|binary]
- check that the attribute is not null
Diffstat (limited to 'storage/ndb/tools')
-rw-r--r-- | storage/ndb/tools/restore/consumer_restore.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp index b7db8145c56..fde1f4c3074 100644 --- a/storage/ndb/tools/restore/consumer_restore.cpp +++ b/storage/ndb/tools/restore/consumer_restore.cpp @@ -1158,19 +1158,22 @@ void BackupRestore::tuple_a(restore_callback_t *cb) char * dataPtr = attr_data->string_value; Uint32 length = 0; - const unsigned char * src = (const unsigned char *)dataPtr; - switch(attr_desc->m_column->getType()){ - case NdbDictionary::Column::Varchar: - case NdbDictionary::Column::Varbinary: - length = src[0] + 1; - break; - case NdbDictionary::Column::Longvarchar: - case NdbDictionary::Column::Longvarbinary: - length = src[0] + (src[1] << 8) + 2; - break; - default: - length = attr_data->size; - break; + if (!attr_data->null) + { + const unsigned char * src = (const unsigned char *)dataPtr; + switch(attr_desc->m_column->getType()){ + case NdbDictionary::Column::Varchar: + case NdbDictionary::Column::Varbinary: + length = src[0] + 1; + break; + case NdbDictionary::Column::Longvarchar: + case NdbDictionary::Column::Longvarbinary: + length = src[0] + (src[1] << 8) + 2; + break; + default: + length = attr_data->size; + break; + } } if (j == 0 && tup.getTable()->have_auto_inc(i)) tup.getTable()->update_max_auto_val(dataPtr,size*arraySize); |