summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-12-14 19:15:57 +0200
committerunknown <heikki@donna.mysql.fi>2001-12-14 19:15:57 +0200
commit8e6ac521eb3a792e70aaa3658f0ff334c5083ce7 (patch)
tree74909cd24e1c41aea56669f20366385f377e8806 /innobase
parent0de5d9930f90fc5a1239a141229a540b408d6b9d (diff)
downloadmariadb-git-8e6ac521eb3a792e70aaa3658f0ff334c5083ce7.tar.gz
rem0rec.ic:
Remove a theoretical overrun in adaptive hash index building innobase/include/rem0rec.ic: Remove a theoretical overrun in adaptive hash index building
Diffstat (limited to 'innobase')
-rw-r--r--innobase/include/rem0rec.ic14
1 files changed, 13 insertions, 1 deletions
diff --git a/innobase/include/rem0rec.ic b/innobase/include/rem0rec.ic
index 1e9ecb47e2e..6b96e3056fa 100644
--- a/innobase/include/rem0rec.ic
+++ b/innobase/include/rem0rec.ic
@@ -947,7 +947,8 @@ rec_get_converted_size(
}
/****************************************************************
-Folds a prefix of a physical record to a ulint. */
+Folds a prefix of a physical record to a ulint. Folds only existing fields,
+that is, checks that we do not run out of the record. */
UNIV_INLINE
ulint
rec_fold(
@@ -963,6 +964,7 @@ rec_fold(
byte* data;
ulint len;
ulint fold;
+ ulint n_fields_rec;
ut_ad(rec_validate(rec));
ut_ad(n_fields <= rec_get_n_fields(rec));
@@ -971,6 +973,16 @@ rec_fold(
/* Only the page supremum and infimum records have 1 field: */
ut_ad(rec_get_n_fields(rec) > 1);
+ n_fields_rec = rec_get_n_fields(rec);
+
+ if (n_fields > n_fields_rec) {
+ n_fields = n_fields_rec;
+ }
+
+ if (n_fields == n_fields_rec) {
+ n_bytes = 0;
+ }
+
fold = ut_fold_dulint(tree_id);
for (i = 0; i < n_fields; i++) {