[
https://issues.apache.org/jira/browse/THRIFT-3873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15681390#comment-15681390
]
ASF GitHub Bot commented on THRIFT-3873:
----------------------------------------
Github user jeking3 commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1128#discussion_r88804989
--- Diff: lib/cpp/src/thrift/transport/THeaderTransport.cpp ---
@@ -375,7 +383,12 @@ void THeaderTransport::resetProtocol() {
}
uint32_t THeaderTransport::getWriteBytes() {
- return wBase_ - wBuf_.get();
+ ptrdiff_t wb = wBase_ - wBuf_.get();
+ if (wb > std::numeric_limits<uint32_t>().max()) {
+ throw TTransportException(TTransportException::CORRUPTED_DATA,
+ "write size is unreasonable");
+ }
--- End diff --
I added apache::thrift::transport::safe_numeric_cast to the
TTransportException header. I couldn't think of a better place to put it for
now... I agree it simplifies the code in many places, and the transport code
seems to be the code closest to the platform where these transform issues exist.
> Fix various compiler warnings when using VS2010
> -----------------------------------------------
>
> Key: THRIFT-3873
> URL: https://issues.apache.org/jira/browse/THRIFT-3873
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.10.0
> Environment: VS2010, Windows
> Reporter: James E. King, III
> Assignee: James E. King, III
> Priority: Trivial
>
> While verifying a defect I had to build the windows thrift C++ library and
> found a number of compiler warnings that needed to be cleaned up.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)