Github user ben-craig commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1128#discussion_r87931714
  
    --- Diff: lib/cpp/src/thrift/transport/THeaderTransport.h ---
    @@ -135,8 +141,9 @@ class THeaderTransport : public 
TVirtualTransport<THeaderTransport, TFramedTrans
       void transform(uint8_t* ptr, uint32_t sz);
     
       uint16_t getNumTransforms() const {
    -    int trans = writeTrans_.size();
    -    return trans;
    +    std::vector<uint16_t>::size_type trans = writeTrans_.size();
    +    assert(trans <= UINT16_MAX);
    --- End diff --
    
    If your casting error checking is just debug asserts, then you might as 
well stick with the casts.
    My preference would be to throw an exception if the size is out of bounds.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to