Commit e4f3146
authored
apacheGH-41317: [C++] Fix crash on invalid Parquet file (apache#41366)
### Rationale for this change
Fixes the crash detailed in apache#41317 in TableBatchReader::ReadNext() on a corrupted Parquet file
### What changes are included in this PR?
Add a validation that all read columns have the same size
### Are these changes tested?
I've tested on the reproducer I provided in apache#41317 that it now triggers a clean error:
```
Traceback (most recent call last):
File "test.py", line 3, in <module>
[_ for _ in parquet_file.iter_batches()]
File "test.py", line 3, in <listcomp>
[_ for _ in parquet_file.iter_batches()]
File "pyarrow/_parquet.pyx", line 1587, in iter_batches
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: columns do not have the same size
```
I'm not sure if/how unit tests for corrupted datasets should be added
### Are there any user-facing changes?
No
**This PR contains a "Critical Fix".**
* GitHub Issue: apache#41317
Authored-by: Even Rouault <even.rouault@spatialys.com>
Signed-off-by: mwish <maplewish117@gmail.com>1 parent de37ee8 commit e4f3146
3 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| 622 | + | |
622 | 623 | | |
623 | 624 | | |
624 | 625 | | |
| |||
632 | 633 | | |
633 | 634 | | |
634 | 635 | | |
| 636 | + | |
635 | 637 | | |
636 | 638 | | |
637 | 639 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
244 | 246 | | |
245 | 247 | | |
246 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1043 | 1043 | | |
1044 | 1044 | | |
1045 | 1045 | | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
1046 | 1056 | | |
1047 | 1057 | | |
1048 | 1058 | | |
| |||
0 commit comments