aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-01-31 17:59:10 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-02-09 19:16:40 +0300
commitc88ff01faaf3dbc93564a15e930bb533a56516d1 (patch)
tree6172c63a181460fbcd40a7fbea97f3ed8f41bd39
parent22faf7825187091e0ac85a196aab658c151f83be (diff)
downloadydb-c88ff01faaf3dbc93564a15e930bb533a56516d1.tar.gz
Intermediate changes
-rw-r--r--contrib/libs/pybind11/include/pybind11/pytypes.h5
-rw-r--r--library/cpp/netliba/v6/udp_address.cpp6
-rw-r--r--library/cpp/netliba/v6/udp_client_server.cpp10
-rw-r--r--library/cpp/netliba/v6/udp_http.cpp8
4 files changed, 17 insertions, 12 deletions
diff --git a/contrib/libs/pybind11/include/pybind11/pytypes.h b/contrib/libs/pybind11/include/pybind11/pytypes.h
index fcad4c609e..6c255c6cde 100644
--- a/contrib/libs/pybind11/include/pybind11/pytypes.h
+++ b/contrib/libs/pybind11/include/pybind11/pytypes.h
@@ -265,6 +265,11 @@ public:
this function automatically. Returns a reference to itself.
\endrst */
const handle &dec_ref() const & {
+#ifdef Py_DEBUG
+ if (!Py_IsInitialized()) {
+ return *this;
+ }
+#endif
#ifdef PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
if (m_ptr != nullptr && !PyGILState_Check()) {
throw_gilstate_error("pybind11::handle::dec_ref()");
diff --git a/library/cpp/netliba/v6/udp_address.cpp b/library/cpp/netliba/v6/udp_address.cpp
index 17540602e9..ba5fd6f45b 100644
--- a/library/cpp/netliba/v6/udp_address.cpp
+++ b/library/cpp/netliba/v6/udp_address.cpp
@@ -278,7 +278,7 @@ namespace NNetliba {
char buf[1000];
if (addr.IsIPv4()) {
int ip = addr.GetIPv4();
- sprintf(buf, "%d.%d.%d.%d:%d",
+ snprintf(buf, sizeof(buf), "%d.%d.%d.%d:%d",
(ip >> 0) & 0xff, (ip >> 8) & 0xff,
(ip >> 16) & 0xff, (ip >> 24) & 0xff,
addr.Port);
@@ -288,9 +288,9 @@ namespace NNetliba {
*BreakAliasing<ui64>(ipv6 + 4) = addr.Interface;
char suffix[100] = "";
if (addr.Scope != 0) {
- sprintf(suffix, "%%%d", addr.Scope);
+ snprintf(suffix, sizeof(suffix), "%%%d", addr.Scope);
}
- sprintf(buf, "[%x:%x:%x:%x:%x:%x:%x:%x%s]:%d",
+ snprintf(buf, sizeof(buf), "[%x:%x:%x:%x:%x:%x:%x:%x%s]:%d",
ntohs(ipv6[0]), ntohs(ipv6[1]), ntohs(ipv6[2]), ntohs(ipv6[3]),
ntohs(ipv6[4]), ntohs(ipv6[5]), ntohs(ipv6[6]), ntohs(ipv6[7]),
suffix, addr.Port);
diff --git a/library/cpp/netliba/v6/udp_client_server.cpp b/library/cpp/netliba/v6/udp_client_server.cpp
index e7cde45242..14f60625f2 100644
--- a/library/cpp/netliba/v6/udp_client_server.cpp
+++ b/library/cpp/netliba/v6/udp_client_server.cpp
@@ -1214,7 +1214,7 @@ namespace NNetliba {
const TUdpAddress& ip = i.first;
const TCongestionControl& cc = *i.second.UdpCongestion;
IIBPeer* ibPeer = i.second.IBPeer.Get();
- sprintf(buf, "%s\tIB: %d, RTT: %g Timeout: %g Window: %g MaxWin: %g FailRate: %g TimeSinceLastRecv: %g Transfers: %d MTU: %d\n",
+ snprintf(buf, sizeof(buf), "%s\tIB: %d, RTT: %g Timeout: %g Window: %g MaxWin: %g FailRate: %g TimeSinceLastRecv: %g Transfers: %d MTU: %d\n",
GetAddressAsString(ip).c_str(),
ibPeer ? ibPeer->GetState() : -1,
cc.GetRTT() * 1000, cc.GetTimeout() * 1000, cc.GetWindow(), cc.GetMaxWindow(), cc.GetFailRate(),
@@ -1227,17 +1227,17 @@ namespace NNetliba {
TString TUdpHost::GetDebugInfo() {
TString res;
char buf[1000];
- sprintf(buf, "Receiving %d msgs, sending %d high prior, %d regular msgs, %d low prior msgs\n",
+ snprintf(buf, sizeof(buf), "Receiving %d msgs, sending %d high prior, %d regular msgs, %d low prior msgs\n",
RecvQueue.ysize(), (int)SendOrderHighPrior.size(), (int)SendOrder.size(), (int)SendOrderLow.size());
res += buf;
TRequesterPendingDataStats pds;
GetPendingDataSize(&pds);
- sprintf(buf, "Pending data size: %" PRIu64 "\n", pds.InpDataSize + pds.OutDataSize);
+ snprintf(buf, sizeof(buf), "Pending data size: %" PRIu64 "\n", pds.InpDataSize + pds.OutDataSize);
res += buf;
- sprintf(buf, " in packets: %d, size %" PRIu64 "\n", pds.InpCount, pds.InpDataSize);
+ snprintf(buf, sizeof(buf), " in packets: %d, size %" PRIu64 "\n", pds.InpCount, pds.InpDataSize);
res += buf;
- sprintf(buf, " out packets: %d, size %" PRIu64 "\n", pds.OutCount, pds.OutDataSize);
+ snprintf(buf, sizeof(buf), " out packets: %d, size %" PRIu64 "\n", pds.OutCount, pds.OutDataSize);
res += buf;
res += "\nCongestion info:\n";
diff --git a/library/cpp/netliba/v6/udp_http.cpp b/library/cpp/netliba/v6/udp_http.cpp
index f318554a76..ab4ec52bf9 100644
--- a/library/cpp/netliba/v6/udp_http.cpp
+++ b/library/cpp/netliba/v6/udp_http.cpp
@@ -1041,9 +1041,9 @@ namespace NNetliba {
char buf[1000];
TRequesterUserQueueSizes* qs = QueueSizes.Get();
- sprintf(buf, "\nRequest queue %d (%d bytes)\n", (int)AtomicGet(qs->ReqCount), (int)AtomicGet(qs->ReqQueueSize));
+ snprintf(buf, sizeof(buf), "\nRequest queue %d (%d bytes)\n", (int)AtomicGet(qs->ReqCount), (int)AtomicGet(qs->ReqQueueSize));
res += buf;
- sprintf(buf, "Response queue %d (%d bytes)\n", (int)AtomicGet(qs->RespCount), (int)AtomicGet(qs->RespQueueSize));
+ snprintf(buf, sizeof(buf), "Response queue %d (%d bytes)\n", (int)AtomicGet(qs->RespCount), (int)AtomicGet(qs->RespQueueSize));
res += buf;
const char* outReqStateNames[] = {
@@ -1061,7 +1061,7 @@ namespace NNetliba {
const TGUID& gg = i->first;
const TOutRequestState& s = i->second;
bool isSync = SyncRequests.find(gg) != SyncRequests.end();
- sprintf(buf, "%s\t%s %s TimePassed: %g %s\n",
+ snprintf(buf, sizeof(buf), "%s\t%s %s TimePassed: %g %s\n",
GetAddressAsString(s.Address).c_str(), GetGuidAsString(gg).c_str(), outReqStateNames[s.State],
s.TimePassed * 1000,
isSync ? "isSync" : "");
@@ -1071,7 +1071,7 @@ namespace NNetliba {
for (TInRequestHash::const_iterator i = InRequests.begin(); i != InRequests.end(); ++i) {
const TGUID& gg = i->first;
const TInRequestState& s = i->second;
- sprintf(buf, "%s\t%s %s\n",
+ snprintf(buf, sizeof(buf), "%s\t%s %s\n",
GetAddressAsString(s.Address).c_str(), GetGuidAsString(gg).c_str(), inReqStateNames[s.State]);
res += buf;
}