Details
Description
The c++ reader crash in parsing the attached file. It's a corrupt orc file with decimal values.
$ build/tools/src/orc-scan decimal_ill_scale.orc Floating point exception (core dumped)
This is a devided-by-zero error:
Core was generated by `build/tools/src/orc-scan decimal_ill_scale.orc'. Program terminated with signal SIGFPE, Arithmetic exception. #0 0x0000000000896c0d in orc::Decimal64ColumnReader::readInt64 (this=0x1010120, value=@0x101aa60: 2222, currentScale=95) at /mnt/volume1/orc/c++/src/ColumnReader.cc:1177 1177 value /= POWERS_OF_TEN[currentScale - scale]; (gdb) bt #0 0x0000000000896c0d in orc::Decimal64ColumnReader::readInt64 (this=0x1010120, value=@0x101aa60: 2222, currentScale=95) at /mnt/volume1/orc/c++/src/ColumnReader.cc:1177 #1 0x0000000000895700 in orc::Decimal64ColumnReader::next (this=0x1010120, rowBatch=..., numValues=5, notNull=0x0) at /mnt/volume1/orc/c++/src/ColumnReader.cc:1268 #2 0x0000000000893880 in orc::StructColumnReader::next (this=0xff9720, rowBatch=..., numValues=5, notNull=0x0) at /mnt/volume1/orc/c++/src/ColumnReader.cc:813 #3 0x0000000000833e86 in orc::RowReaderImpl::next (this=0x10044b0, data=...) at /mnt/volume1/orc/c++/src/Reader.cc:832 #4 0x000000000082d274 in scanFile (out=..., filename=0x7ffc132d3755 "decimal_ill_scale.orc", batchSize=1024) at /mnt/volume1/orc/tools/src/FileScan.cc:39 #5 0x000000000082d4c5 in main (argc=1, argv=0x7ffc132d1940) at /mnt/volume1/orc/tools/src/FileScan.cc:84 (gdb) p currentScale $1 = 95 (gdb) p scale $2 = 0
95 is out of the length of the POWERS_OF_TEN array. So it gets value 0 unexpectedly.
class Decimal64ColumnReader: public ColumnReader { public: static const uint32_t MAX_PRECISION_64 = 18; static const uint32_t MAX_PRECISION_128 = 38; static const int64_t POWERS_OF_TEN[MAX_PRECISION_64 + 1];
We should check the range of currentScale in Decimal64ColumnReader::readInt64 to avoid this.
Attachments
Attachments
Issue Links
- blocks
-
ORC-315 More robust on reading random corrupt files
- Open
- links to