Skip to content

We should test that the new protobuf well-formedness-checker actually catches malformed protobufs. #441

Closed

Description

@mlucy
No description provided.

Activity

  1. coffeemug commented on Mar 12, 2013

    @coffeemug
    Contributor

    Could you extrapolate on what needs to be tested, by whom, and how?

  2. mlucy commented on Mar 12, 2013

    @mlucy
    MemberAuthor
    • What needs to be tested: if a client sends a malformed protobuf, the server should respond with a sane message.
    • By whom: Probably me or Bill since we know the clients.
    • How: client-dependent.

    For example:

    irb(main):148:0> x = r.add(1, 2)                                      
    r(1).add(2)                                                           
    irb(main):149:0> x.instance_eval("@body")                             
    type: ADD                                                             
    args {                                                                
      type: DATUM                                                         
      datum {                                                             
        type: R_NUM                                                       
        r_num: 1                                                          
      }                                                                   
    }                                                                     
    args {                                                                
      type: DATUM                                                         
      datum {                                                             
        type: R_NUM                                                       
        r_num: 2                                                          
      }                                                                   
    }                                                                     
    
    irb(main):150:0> x.run                                                
    3.0                                                                   
    irb(main):151:0> x.instance_eval("@body.type = nil; @body")           
    args {                                                                
      type: DATUM                                                         
      datum {                                                             
        type: R_NUM                                                       
        r_num: 1                                                          
      }                                                                   
    }                                                                     
    args {                                                                
      type: DATUM                                                         
      datum {                                                             
        type: R_NUM                                                       
        r_num: 2                                                          
      }                                                                   
    }                                                                     
    
    irb(main):152:0> x.run                                                
    RethinkDB::RqlDriverError: MALFRORMED PROTOBUF (missing field `type`):
    args {                                                                
      type: DATUM                                                         
      datum {                                                             
        type: R_NUM                                                       
        r_num: 1                                                          
      }                                                                   
    }                                                                     
    args {                                                                
      type: DATUM                                                         
      datum {                                                             
        type: R_NUM                                                       
        r_num: 2                                                          
      }                                                                   
    }                                                                     
    
    Failed assertion: (t).has_type()                                      
    At: ../src/rdb_protocol/validate.cc:112                               
    Backtrace:                                                            
    r(1).0(2)                                                             
    ^^^^^^^^^                                                             
    Erronious_Portion_Constructed:                                        
            from (irb):148:in `irb_binding'                               
            from /usr/lib/ruby/1.8/irb/workspace.rb:52:in `irb_binding'   
            from :0                                                       
    Called:                                                               
            from ./lib/shim.rb:44:in `response_to_native'                 
            from ./lib/net.rb:118:in `run'                                
            from ./lib/net.rb:25:in `run'                                 
            from (irb):152                                                
            from :0                                                       
  3. mlucy commented on Mar 12, 2013

    @mlucy
    MemberAuthor

    Note that the Ruby pretty-printer gets confused by the malformed protobuf; I think that's fine.

  4. mlucy commented on Mar 12, 2013

    @mlucy
    MemberAuthor

    Err, and I just fixed the typo in the error message.

  5. mlucy commented on Mar 12, 2013

    @mlucy
    MemberAuthor

    Although maybe we should leave it as "MALFROMED" just for the lulz.

  6. mlucy commented on Mar 12, 2013

    @mlucy
    MemberAuthor

    Actually, we could also do a unit test for this, so if Marc has more free time than me or Bill maybe he could do it.

  7. larkost commented on Jul 22, 2014

    @larkost
    Collaborator

    @mlucy Is this still needed?

  8. modified the milestones: outdated, backlog on Jul 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions