You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2022/01/24 02:41:45 UTC

[GitHub] [orc] HeenaBansal2009 opened a new pull request #1023: Fix out of Bound index in protobuf messages

HeenaBansal2009 opened a new pull request #1023:
URL: https://github.com/apache/orc/pull/1023


   
   
   
   ### What changes were proposed in this pull request?
   Validated corrupted footer in Protobuf messages before converting Protobuf message.
   This PR fixes #1021
   https://github.com/apache/orc/issues/1021
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r791207092



##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Could you describe what happens after this PR? Previously, you filed an issue with `it crashed`.

##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Could you describe what happens after this PR? Previously, you filed the issue with `it crashed`.

##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Could you add some description into this PR's PR description about what happens after this PR? Previously, you filed the issue with `it crashed`.

##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Please put it into the PR description instead of commenting here.
   The PR description will be a commit message later.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r793004502



##########
File path: c++/src/TypeImpl.cc
##########
@@ -465,6 +466,8 @@ namespace orc {
     case proto::Type_Kind_STRUCT: {
       TypeImpl* result = new TypeImpl(STRUCT);
       ret = std::unique_ptr<Type>(result);
+     if (type.subtypes_size() > type.fieldnames_size())

Review comment:
       Could you follow the coding style? This new addition has a wrong indentation.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r793003325



##########
File path: c++/src/TypeImpl.cc
##########
@@ -24,9 +24,9 @@
 #include <sstream>
 
 namespace orc {
-
-  Type::~Type() {
-    // PASS
+  
+   Type::~Type() {
+   // PASS

Review comment:
       These 3-line changes looks wrong. Could you recover to the original code?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #1023:
URL: https://github.com/apache/orc/pull/1023#issuecomment-1023524991


   Thank you, @HeenaBansal2009 .
   Do you have an Apache JIRA id? I want to assign ORC-1101 to you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r791207092



##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Could you add some description into this PR's PR description about what happens after this PR? Previously, you filed the issue with `it crashed`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] HeenaBansal2009 commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
HeenaBansal2009 commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r791370159



##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r793003942



##########
File path: c++/src/TypeImpl.cc
##########
@@ -454,6 +454,7 @@ namespace orc {
         throw ParseError("Illegal MAP type that doesn't contain two subtypes");
       if (type.kind() == proto::Type_Kind_UNION && type.subtypes_size() == 0)
         throw ParseError("Illegal UNION type that doesn't contain any subtypes");
+      

Review comment:
       We usually don't mix the bug fix and a style fix in a single PR. Please remove this redundant style change from this PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] HeenaBansal2009 commented on pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
HeenaBansal2009 commented on pull request #1023:
URL: https://github.com/apache/orc/pull/1023#issuecomment-1023533943


   > Thank you, @HeenaBansal2009 .
   > Do you have an Apache JIRA id? I want to assign [ORC-1101](https://issues.apache.org/jira/browse/ORC-1101) to you.
   
   Thanks @dongjoon-hyun  for merging the PR.  My apache JIRA username is  :  heenabansal


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r791207092



##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Could you describe what happens after this PR? Previously, you filed an issue with `it crashed`.

##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Could you describe what happens after this PR? Previously, you filed the issue with `it crashed`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r793005252



##########
File path: c++/test/TestType.cc
##########
@@ -404,6 +404,21 @@ namespace orc {
     illUnionType.set_kind(proto::Type_Kind_UNION);
     testCorruptHelper(illUnionType, footer,
         "Illegal UNION type that doesn't contain any subtypes");
+
+    proto::Type illStructType;
+    proto::Type structType;
+    illStructType.set_kind(proto::Type_Kind_STRUCT);
+    structType.set_kind(proto::Type_Kind_STRUCT);
+    structType.add_subtypes(0);  // construct a loop back to root
+    structType.add_fieldnames("root");
+    illStructType.add_subtypes(1);
+    illStructType.add_fieldnames("f1");
+    illStructType.add_subtypes(2);
+    *(footer.add_types()) = illStructType;
+    *(footer.add_types()) = structType;
+    testCorruptHelper(illStructType, footer,
+        "Illegal STRUCT type that contains less fieldnames than subtypes");

Review comment:
       - Thank you for adding a new test coverage.
   - And, please remove the redundant empty line 421.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r791250012



##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Please put it into the PR description instead of commenting here.
   The PR description will be a commit message later.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #1023:
URL: https://github.com/apache/orc/pull/1023#issuecomment-1023524095


   Merged to main for Apache ORC 1.8.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] HeenaBansal2009 commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
HeenaBansal2009 commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r791216879



##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       > Could you describe what happens after this PR? Previously, you filed the issue with `it crashed`.
   
   @dongjoon-hyun , Thanks for reviewing the PR. I can update as below : 
   
   // Validate the indices in the Protobuf message type tree especially for the Type_Kind_STRUCT when fieldnames are less than the subtypes_size() , so we won't crash when we convert the proto::Types to TypeImpls. 

##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun merged pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun merged pull request #1023:
URL: https://github.com/apache/orc/pull/1023


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] HeenaBansal2009 commented on a change in pull request #1023: [C++] Fix out of Bound index in protobuf messages

Posted by GitBox <gi...@apache.org>.
HeenaBansal2009 commented on a change in pull request #1023:
URL: https://github.com/apache/orc/pull/1023#discussion_r791216879



##########
File path: c++/src/TypeImpl.cc
##########
@@ -413,6 +413,8 @@ namespace orc {
   std::unique_ptr<Type> convertType(const proto::Type& type,
                                     const proto::Footer& footer) {
     std::unique_ptr<Type> ret;
+    //check for corrupt footers before conversion
+    checkProtoTypes(footer);

Review comment:
       > Could you describe what happens after this PR? Previously, you filed the issue with `it crashed`.
   
   @dongjoon-hyun , Thanks for reviewing the PR. I can update as below : 
   
   // Validate the indices in the Protobuf message type tree especially for the Type_Kind_STRUCT when fieldnames are less than the subtypes_size() , so we won't crash when we convert the proto::Types to TypeImpls. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #1023:
URL: https://github.com/apache/orc/pull/1023#issuecomment-1022663236


   cc @wgtmac , @williamhyun , @stiga-huang 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #1023:
URL: https://github.com/apache/orc/pull/1023#issuecomment-1023548391


   Thanks. I added you to the Apache ORC contributor group and assigned ORC-1101 to you, @HeenaBansal2009 .
   Welcome to the Apache ORC community. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] HeenaBansal2009 commented on pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
HeenaBansal2009 commented on pull request #1023:
URL: https://github.com/apache/orc/pull/1023#issuecomment-1023550185


   > Thanks. I added you to the Apache ORC contributor group and assigned [ORC-1101](https://issues.apache.org/jira/browse/ORC-1101) to you, @HeenaBansal2009 .
   > Welcome to the Apache ORC community.
   
   
   
   > 
   
   Thank you @dongjoon-hyun. Since the issue is resolved. can I close ORC-1101?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [orc] dongjoon-hyun commented on pull request #1023: ORC-1101: [C++] Improve malformed STRUCT handling

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #1023:
URL: https://github.com/apache/orc/pull/1023#issuecomment-1023555089


   For now, `Resolve` is enough. We will switch `Resolved` to `Closed` when Apache ORC 1.8.0 is released officially.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org