summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2004-12-10 16:06:49 +0400
committerunknown <hf@deer.(none)>2004-12-10 16:06:49 +0400
commit95056a0b657b6d4f3a9106e4f21dfdf348da3690 (patch)
treefac5d0ecf6bba7008a8028e86bee3f9cee4960a1 /myisam
parent7a60d1558a89df5f198884d360a14bf2b48f2c49 (diff)
downloadmariadb-git-95056a0b657b6d4f3a9106e4f21dfdf348da3690.tar.gz
Fix for bug #6516 (Server crash loading spatial data)
(after discussion with SerG) include/my_base.h: Handler error code added myisam/mi_write.c: New error code handled myisam/rt_index.c: check for zero length added myisam/sp_key.c: zero length check added mysql-test/r/gis-rtree.result: appropriate test result mysql-test/t/gis-rtree.test: test case sql/handler.cc: new error code handling added
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_write.c7
-rw-r--r--myisam/rt_index.c3
-rw-r--r--myisam/sp_key.c5
3 files changed, 11 insertions, 4 deletions
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index 303e924118f..7d053ddfd22 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -124,8 +124,8 @@ int mi_write(MI_INFO *info, byte *record)
{
if (local_lock_tree)
rw_unlock(&share->key_root_lock[i]);
- DBUG_PRINT("error",("Got error: %d on write",my_errno));
- goto err;
+ DBUG_PRINT("error",("Got error: %d on write",my_errno));
+ goto err;
}
}
if (local_lock_tree)
@@ -159,7 +159,8 @@ int mi_write(MI_INFO *info, byte *record)
err:
save_errno=my_errno;
- if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL)
+ if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
+ my_errno == HA_ERR_NULL_IN_SPATIAL)
{
if (info->bulk_insert)
{
diff --git a/myisam/rt_index.c b/myisam/rt_index.c
index cfb2ca877f4..bdf5ee9c60f 100644
--- a/myisam/rt_index.c
+++ b/myisam/rt_index.c
@@ -710,7 +710,8 @@ err1:
int rtree_insert(MI_INFO *info, uint keynr, uchar *key, uint key_length)
{
- return (rtree_insert_level(info, keynr, key, key_length, -1) == -1) ? -1 : 0;
+ return (!key_length ||
+ (rtree_insert_level(info, keynr, key, key_length, -1) == -1)) ? -1 : 0;
}
diff --git a/myisam/sp_key.c b/myisam/sp_key.c
index 0e424a9e193..b61e8094cde 100644
--- a/myisam/sp_key.c
+++ b/myisam/sp_key.c
@@ -50,6 +50,11 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
dlen = _mi_calc_blob_length(keyseg->bit_start, pos);
memcpy_fixed(&dptr, pos + keyseg->bit_start, sizeof(char*));
+ if (!dptr)
+ {
+ my_errno= HA_ERR_NULL_IN_SPATIAL;
+ return 0;
+ }
sp_mbr_from_wkb(dptr + 4, dlen - 4, SPDIMS, mbr); /* SRID */
for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++)