Skip to content

Commit ed36fc3

Browse files
committed
MDEV-18025: Detect corrupted innodb_page_compression=zlib pages
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
1 parent 8ede9b3 commit ed36fc3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

storage/innobase/fil/fil0pagecompress.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,14 @@ UNIV_INTERN ulint fil_page_decompress(byte* tmp_buf, byte* buf)
341341
case PAGE_ZLIB_ALGORITHM:
342342
{
343343
uLong len = srv_page_size;
344-
if (Z_OK != uncompress(tmp_buf, &len,
344+
if (Z_OK == uncompress(tmp_buf, &len,
345345
buf + header_len,
346346
uLong(actual_size))
347-
&& len != srv_page_size) {
348-
return 0;
347+
&& len == srv_page_size) {
348+
break;
349349
}
350350
}
351-
break;
351+
return 0;
352352
#ifdef HAVE_LZ4
353353
case PAGE_LZ4_ALGORITHM:
354354
if (LZ4_decompress_safe(reinterpret_cast<const char*>(buf)

storage/xtradb/fil/fil0pagecompress.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,14 @@ UNIV_INTERN ulint fil_page_decompress(byte* tmp_buf, byte* buf)
341341
case PAGE_ZLIB_ALGORITHM:
342342
{
343343
uLong len = srv_page_size;
344-
if (Z_OK != uncompress(tmp_buf, &len,
344+
if (Z_OK == uncompress(tmp_buf, &len,
345345
buf + header_len,
346346
uLong(actual_size))
347-
&& len != srv_page_size) {
348-
return 0;
347+
&& len == srv_page_size) {
348+
break;
349349
}
350350
}
351-
break;
351+
return 0;
352352
#ifdef HAVE_LZ4
353353
case PAGE_LZ4_ALGORITHM:
354354
if (LZ4_decompress_safe(reinterpret_cast<const char*>(buf)

0 commit comments

Comments
 (0)