Quanlong Huang created ORC-1159:
-----------------------------------

             Summary: [C++] Crash when the last stripe is skipped
                 Key: ORC-1159
                 URL: https://issues.apache.org/jira/browse/ORC-1159
             Project: ORC
          Issue Type: Bug
          Components: C++
    Affects Versions: 1.8.0
            Reporter: Quanlong Huang
         Attachments: alltypes_non_acid.orc

I encountered a crash when using orc-scan to read the attached orc file with 
sargs "id < 10".
{code:java}
Program received signal SIGSEGV, Segmentation fault.
0x0000000000764039 in orc::RowReaderImpl::next (data=..., this=0xf67610) at 
/home/quanlong/workspace/orc/c++/src/Reader.cc:1153
1153        if (enableEncodedBlock) {
(gdb) bt
#0  0x0000000000764039 in orc::RowReaderImpl::next (data=..., this=0xf67610) at 
/home/quanlong/workspace/orc/c++/src/Reader.cc:1153
#1  orc::RowReaderImpl::next (this=0xf67610, data=...) at 
/home/quanlong/workspace/orc/c++/src/Reader.cc:1122
#2  0x0000000000745646 in scanFile(std::ostream&, char const*, unsigned long, 
orc::RowReaderOptions const&) () at 
/home/quanlong/workspace/orc/tools/src/FileScan.cc:34
#3  0x0000000000741883 in main () at 
/home/quanlong/workspace/orc/tools/src/FileScan.cc:58
#4  0x00007ffff68ab840 in __libc_start_main (main=0x7416c0 <main>, argc=2, 
argv=0x7fffffffdd48, init=<optimized out>, fini=<optimized out>, 
rtld_fini=<optimized out>, stack_end=0x7fffffffdd38) at ../csu/libc-start.c:291
#5  0x0000000000745479 in _start () at 
/home/quanlong/workspace/orc/tools/src/FileScan.cc:49
(gdb) p reader
$1 = std::unique_ptr<orc::ColumnReader> = {get() = 0x0}
{code}
Codes:
{code:java}
    if (enableEncodedBlock) {
      reader->nextEncoded(data, rowsToRead, nullptr);
    }
    else {
      reader->next(data, rowsToRead, nullptr);
    }
{code}
{{reader}} is a nullptr thus the process crashes.

The bug is introduced by a recent improvement (ORC-969). When startNextStripe() 
skippes all the remaining stripes, we should set rowsToRead to 0.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to