Repository navigation
ARROW-13655: [C++][Parquet] Disable Thrift message size protections #11123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -496,3 +496,29 @@ def test_parquet_metadata_empty_to_dict(tempdir): | |
| assert len(metadata_dict["row_groups"]) == 1 | ||
| assert len(metadata_dict["row_groups"][0]["columns"]) == 1 | ||
| assert metadata_dict["row_groups"][0]["columns"][0]["statistics"] is None | ||
|
|
||
|
|
||
| @pytest.mark.slow | ||
| @pytest.mark.large_memory | ||
| def test_metadata_exceeds_message_size(): | ||
| # ARROW-13655: Thrift may enable a defaut message size that limits | ||
| # the size of Parquet metadata that can be written. | ||
| NCOLS = 1000 | ||
| NREPEATS = 4000 | ||
|
|
||
| table = pa.table({str(i): np.random.randn(10) for i in range(NCOLS)}) | ||
|
|
||
| with pa.BufferOutputStream() as out: | ||
| pq.write_table(table, out) | ||
| buf = out.getvalue() | ||
|
|
||
| original_metadata = pq.read_metadata(pa.BufferReader(buf)) | ||
| metadata = pq.read_metadata(pa.BufferReader(buf)) | ||
| for i in range(NREPEATS): | ||
| metadata.append_row_groups(original_metadata) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, the reason that the reproducer is reading in the metadata twice, and then appending the one many times to the other, is because appending an object to itself is buggy -> https://issues.apache.org/jira/browse/ARROW-13654 |
||
|
|
||
| with pa.BufferOutputStream() as out: | ||
| metadata.write_metadata_file(out) | ||
| buf = out.getvalue() | ||
|
|
||
| metadata = pq.read_metadata(pa.BufferReader(buf)) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
ThriftBuffer(akaTMemoryBuffer) constructor sets the max limit to the buffer asstd::numeric_limits<uint32_t>::max(). Is the intent here to useintas to cap at a lower limit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is different.We're talking about
maxMessageSize, notmaxBufferSize.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to recall in the past thrift wasn't good about memory bombs produced by the fuzzer is this fixed in 14?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See a bit below.
setStringSizeLimitandsetContainerSizeLimitshould protect us against Thrift memory bombs, IIRC. However, we don't have any protection against compression memory bombs.