From 0f06dca83197e317384609c8c7e1413289a1be03 Mon Sep 17 00:00:00 2001 From: rfree2monero Date: Thu, 12 Feb 2015 21:53:52 +0100 Subject: [PATCH] fixed size_t on windows thought it was already fixed, apparently commit got lost somewhere --- contrib/epee/include/net/abstract_tcp_server2.inl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 5855f7f8..3dff6da5 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -357,7 +357,10 @@ PRAGMA_WARNING_DISABLE_VS(4355) const t_safe chunksize_max = chunksize_good * 2 ; const bool allow_split = (m_connection_type == RPC) ? false : true; // TODO config - if (allow_split && (cb > chunksize_max)) { + ASRT(! (chunksize_max<0) ); // make sure it is unsigned before removin sign with cast: + long long unsigned int chunksize_max_unsigned = static_cast( chunksize_max ) ; + + if (allow_split && (cb > chunksize_max_unsigned)) { { // LOCK: chunking epee::critical_region_t send_guard(m_chunking_lock); // *** critical *** @@ -380,7 +383,10 @@ PRAGMA_WARNING_DISABLE_VS(4355) ASRT(len<=chunksize_good); // pos=8; len=4; all=10; len=3; - ASRT(len>0); ASRT(len < std::numeric_limits::max()); // yeap we want strong < then max size, to be sure + ASRT(! (len<0) ); // check before we cast away sign: + unsigned long long int len_unsigned = static_cast( len ); + ASRT(len>0); // (redundand) + ASRT(len_unsigned < std::numeric_limits::max()); // yeap we want strong < then max size, to be sure void *chunk_start = ((char*)ptr) + pos; _fact_c("net/out/size","chunk_start="<