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!
---