Skip to content

Commit 7f73f2a

Browse files
driver: bugfix
Using maybeToList will cause the accumulator to hold the trailing bytes twice. This will result in the annotator grabbing the wrong fragments in raw format. The messages will decode properly; however if these raw fragments are forwarded to other peers, they will be rejected and the remote will close the connection.
1 parent c1e3188 commit 7f73f2a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
<!--
9+
### Breaking
10+
11+
- A bullet item for the Breaking category.
12+
13+
-->
14+
15+
### Non-Breaking
16+
17+
- bugfix `runAnnotatedDecoderWithChannel`

ouroboros-network-framework/src/Ouroboros/Network/Driver/Simple.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ import Control.Monad.Class.MonadFork
5050
import Control.Monad.Class.MonadThrow
5151
import Control.Tracer (Tracer (..), contramap, traceWith)
5252
import Data.Functor.Identity (Identity (..))
53-
import Data.Maybe (maybeToList)
5453

5554

5655
-- $intro
@@ -327,7 +326,7 @@ runAnnotatedDecoderWithChannel
327326
-> DecodeStep bytes failure m (bytes -> a)
328327
-> m (Either failure (a, Maybe bytes))
329328

330-
runAnnotatedDecoderWithChannel Channel{recv} bs0 = go (maybeToList bs0) bs0
329+
runAnnotatedDecoderWithChannel Channel{recv} = go []
331330
where
332331
go :: [bytes]
333332
-> Maybe bytes

0 commit comments

Comments
 (0)