summaryrefslogtreecommitdiff
path: root/innobase/ibuf
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-05-18 21:20:03 +0300
committerunknown <heikki@donna.mysql.fi>2001-05-18 21:20:03 +0300
commitf194e4e0edd12989e2920e0eab9688faa2d557e6 (patch)
tree00e3b872e7dffe18458106cfa068f5644facc8fd /innobase/ibuf
parent62198cbc796d554dfd4eb6cf596b91a625b02f24 (diff)
downloadmariadb-git-f194e4e0edd12989e2920e0eab9688faa2d557e6.tar.gz
ibuf0ibuf.c Insert buffer calculated SQL NULL size wrong, causing overflow and assertion failure in some cases
log0log.c Retrieve a dummy value from a function to prevent gcc crashing on HP-UX innobase/log/log0log.c: Retrieve a dummy value from a function to prevent gcc crashing on HP-UX innobase/ibuf/ibuf0ibuf.c: Insert buffer calculated SQL NULL size wrong, causing overflow and assertion failure in some cases BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'innobase/ibuf')
-rw-r--r--innobase/ibuf/ibuf0ibuf.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c
index 960ceb666f1..7227b54e71e 100644
--- a/innobase/ibuf/ibuf0ibuf.c
+++ b/innobase/ibuf/ibuf0ibuf.c
@@ -1002,24 +1002,40 @@ ibuf_rec_get_volume(
/*================*/
/* out: size of index record in bytes + an upper
limit of the space taken in the page directory */
- rec_t* rec) /* in: ibuf record */
+ rec_t* ibuf_rec)/* in: ibuf record */
{
+ dtype_t dtype;
+ ulint data_size = 0;
ulint n_fields;
- byte* field;
+ byte* types;
+ byte* data;
ulint len;
- ulint data_size;
+ ulint i;
ut_ad(ibuf_inside());
ut_ad(rec_get_n_fields(rec) > 2);
+
+ n_fields = rec_get_n_fields(ibuf_rec) - 2;
- n_fields = rec_get_n_fields(rec) - 2;
+ types = rec_get_nth_field(ibuf_rec, 1, &len);
- field = rec_get_nth_field(rec, 2, &len);
+ ut_ad(len == n_fields * DATA_ORDER_NULL_TYPE_BUF_SIZE);
- data_size = rec_get_data_size(rec) - (field - rec);
+ for (i = 0; i < n_fields; i++) {
+ data = rec_get_nth_field(ibuf_rec, i + 2, &len);
+
+ dtype_read_for_order_and_null_size(&dtype,
+ types + i * DATA_ORDER_NULL_TYPE_BUF_SIZE);
+
+ if (len == UNIV_SQL_NULL) {
+ data_size += dtype_get_sql_null_size(&dtype);
+ } else {
+ data_size += len;
+ }
+ }
return(data_size + rec_get_converted_extra_size(data_size, n_fields)
- + page_dir_calc_reserved_space(1));
+ + page_dir_calc_reserved_space(1));
}
/*************************************************************************