From aebd74e23298e9c60775548698550011298ea1e1 Mon Sep 17 00:00:00 2001
From: marko <>
Date: Wed, 31 Oct 2007 12:42:38 +0000
Subject: [PATCH] branches/zip: Improve Valgrind instrumentation.

page_zip_compress(): Assert that the contents of the uncompressed page
is entirely initialized.

page_zip_decompress(): Assert that the contents of the compressed page
is entirely initialized.  Assert that the uncompressed page is entirely
writeable.  Flag the uncompressed page uninitialized in the beginning.
---
 page/page0zip.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/page/page0zip.c b/page/page0zip.c
index 1b2407649b..b46b161c6a 100644
--- a/page/page0zip.c
+++ b/page/page0zip.c
@@ -1052,6 +1052,8 @@ page_zip_compress(
 	ut_ad(page_simple_validate_new((page_t*) page));
 	ut_ad(page_zip_simple_validate(page_zip));
 
+	UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
+
 	/* Check the data that will be omitted. */
 	ut_a(!memcmp(page + (PAGE_NEW_INFIMUM - REC_N_NEW_EXTRA_BYTES),
 		     infimum_extra, sizeof infimum_extra));
@@ -2477,6 +2479,8 @@ page_zip_decompress(
 	ulint*		offsets;
 
 	ut_ad(page_zip_simple_validate(page_zip));
+	UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE);
+	UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
 
 	/* The dense directory excludes the infimum and supremum records. */
 	n_dense = page_dir_get_n_heap(page_zip->data) - PAGE_HEAP_NO_USER_LOW;
@@ -2492,6 +2496,7 @@ page_zip_decompress(
 	/* Clear the page. */
 	memset(page, 0x55, UNIV_PAGE_SIZE);
 #endif /* UNIV_ZIP_DEBUG */
+	UNIV_MEM_INVALID(page, UNIV_PAGE_SIZE);
 	/* Copy the page header. */
 	memcpy(page, page_zip->data, PAGE_DATA);
 
-- 
2.30.9