orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stiga-huang <...@git.apache.org>
Subject [GitHub] orc pull request #231: ORC-317: [C++] check that indices in the protobuf typ...
Date Fri, 23 Mar 2018 09:09:31 GMT
Github user stiga-huang commented on a diff in the pull request:

    https://github.com/apache/orc/pull/231#discussion_r176673942
  
    --- Diff: c++/src/Reader.cc ---
    @@ -897,6 +897,27 @@ namespace orc {
         return REDUNDANT_MOVE(postscript);
       }
     
    +  // ORC-317: check that indices in the type tree are valid, so we won't crash
    +  // when we convert the proto::Types to TypeImpls.
    +  void checkProtoTypeIds(int &index, const proto::Footer &footer) {
    +    if (index >= footer.types_size())
    +      throw ParseError(std::string("Footer is corrupt that it lost types(") +
    +          std::to_string(index) + ")");
    +    const proto::Type& type = footer.types(index);
    +
    +    int origin_index = index;
    +    for (int i = 0; i < type.subtypes_size(); ++i) {
    +      int proto_index = static_cast<int>(type.subtypes(i));
    --- End diff --
    
    That's cool!


---

Mime
View raw message