Skip to content

Commit

Permalink
MDEV-18025: Detect corrupted innodb_page_compression=zlib pages
Browse files Browse the repository at this point in the history
In MDEV-13103, I made a mistake in the error handling of
page_compressed=1 decryption when the default
innodb_compression_algorithm=zlib is used.
Due to this mistake, with certain versions of zlib,
MariaDB would fail to detect a corrupted page.

The problem was uncovered by the following tests:
mariabackup.unencrypted_page_compressed
mariabackup.encrypted_page_compressed
  • Loading branch information
dr-m committed Dec 20, 2018
1 parent 8ede9b3 commit ed36fc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions storage/innobase/fil/fil0pagecompress.cc
Expand Up @@ -341,14 +341,14 @@ UNIV_INTERN ulint fil_page_decompress(byte* tmp_buf, byte* buf)
case PAGE_ZLIB_ALGORITHM:
{
uLong len = srv_page_size;
if (Z_OK != uncompress(tmp_buf, &len,
if (Z_OK == uncompress(tmp_buf, &len,
buf + header_len,
uLong(actual_size))
&& len != srv_page_size) {
return 0;
&& len == srv_page_size) {
break;
}
}
break;
return 0;
#ifdef HAVE_LZ4
case PAGE_LZ4_ALGORITHM:
if (LZ4_decompress_safe(reinterpret_cast<const char*>(buf)
Expand Down
8 changes: 4 additions & 4 deletions storage/xtradb/fil/fil0pagecompress.cc
Expand Up @@ -341,14 +341,14 @@ UNIV_INTERN ulint fil_page_decompress(byte* tmp_buf, byte* buf)
case PAGE_ZLIB_ALGORITHM:
{
uLong len = srv_page_size;
if (Z_OK != uncompress(tmp_buf, &len,
if (Z_OK == uncompress(tmp_buf, &len,
buf + header_len,
uLong(actual_size))
&& len != srv_page_size) {
return 0;
&& len == srv_page_size) {
break;
}
}
break;
return 0;
#ifdef HAVE_LZ4
case PAGE_LZ4_ALGORITHM:
if (LZ4_decompress_safe(reinterpret_cast<const char*>(buf)
Expand Down

0 comments on commit ed36fc3

Please sign in to comment.