From 69619bcb0e8e64047bb9a6b1f698b521117ed0cf Mon Sep 17 00:00:00 2001 From: Wondertan Date: Thu, 24 Oct 2024 05:07:44 +0200 Subject: [PATCH 1/2] bitswap(session): fix slice prealloc --- bitswap/client/internal/session/sessionwants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitswap/client/internal/session/sessionwants.go b/bitswap/client/internal/session/sessionwants.go index 97c3e7800..4653ef872 100644 --- a/bitswap/client/internal/session/sessionwants.go +++ b/bitswap/client/internal/session/sessionwants.go @@ -57,7 +57,7 @@ func (sw *sessionWants) GetNextWants() []cid.Cid { currentLiveCount := len(sw.liveWants) toAdd := sw.broadcastLimit - currentLiveCount liveSize := min(toAdd, sw.toFetch.Len()) - if liveSize == 0 { + if liveSize <= 0 { return nil } From 4b3e8ae8468b961217b51422b5bfb47c63c448c2 Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:45:37 -1000 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5996ef3d8..fe0905de8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ The following emojis are used to highlight certain changes: ### Fixed +- Fix panic if current live count is greater than broadcast limit [#702](https://github.com/ipfs/boxo/pull/702) + ### Security ## [v0.24.1]