Bug#23139 - myisamchk and mysqld crash when trying to access table

A corrupted compressed table could crash the server and
myisamchk.

The data file of an uncompressed table contains just the records.
There is no header in the data file.

However the data file of a compressed table has a header.
The header describes how the table was compressed. This
information is necessary to extract the records from the
compressed data file.

Part of the compressed data file header are the [de]code tables.
They are numeric representations of the Huffman trees used for
coding and decoding. A Huffman tree is a binary tree. Every
node has two childs. A child can be a leaf or a branch. Leaves
contain the decoded value. Branches point to another tree node.

Since the [de]code table is represented as an array of childs,
the branches need to point at a child within the same array.
The corruption of the compressed data file from the bug report
was a couple of branches that pointed outside their array.
This condition had not been correctly checked.

I added some checks for the pointers in the decode tables.
This type of corruption will no longer crash the server or
myisamchk.

No test case. A corrupted compressed table is required.
parent 1daa6a71
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment