<!-- XE-13304 · [net/gossip.go] H3: gossipHandler() tidak handle message yang terlalu besar — memory exhaustion · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13304>. The page is the record; this is the same page for reading.*

XE-13304 · Bounty

# \[net/gossip.go\] H3: gossipHandler() tidak handle message yang terlalu besar — memory exhaustion

Closed · invalid
—
[xe#449](https://github.com/xeprotocol/xe/issues/449)
filed 2026-11-12 02:53 UTC
by wahyu20260100233-ops

Verdict
:   Invalid

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:51 UTC

Told
:   2026-11-20 00:50 UTC

### Patches

None linked.

### History

- [559446](https://bounty.xe.network/log/559446) 2026-11-20 00:50 UTC reply.mirrored
- [558515](https://bounty.xe.network/log/558515) 2026-11-20 00:49 UTC reply.sent
- [554116](https://bounty.xe.network/log/554116) 2026-11-20 00:36 UTC github.state\_pushed
- [554114](https://bounty.xe.network/log/554114) 2026-11-20 00:36 UTC github.labels
- [553379](https://bounty.xe.network/log/553379) 2026-11-20 00:33 UTC proposal.adopted
- [553215](https://bounty.xe.network/log/553215) 2026-11-20 00:33 UTC proposal.adopted
- [553214](https://bounty.xe.network/log/553214) 2026-11-20 00:33 UTC ticket.status new → closed
- [552898](https://bounty.xe.network/log/552898) 2026-11-20 00:33 UTC proposal.adopted
- [552897](https://bounty.xe.network/log/552897) 2026-11-20 00:33 UTC ticket.facts area
- [552896](https://bounty.xe.network/log/552896) 2026-11-20 00:33 UTC proposal.adopted
- [552895](https://bounty.xe.network/log/552895) 2026-11-20 00:33 UTC ticket.facts
- [550347](https://bounty.xe.network/log/550347) 2026-11-20 00:28 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-13304) · [JSON](https://bounty.xe.network/v1/tickets/XE-13304) · [markdown](https://bounty.xe.network/XE-13304.md)

### Report

## Ringkasan

`gossipHandler` menerima message tanpa size limit. Kalau message terlalu besar, bisa menyebabkan memory exhaustion.

## Lokasi

- File: `net/gossip.go`
- Lines: 219-245

## Kode

```
func (g *Gossip) gossipHandler(stream network.Stream) {
    ...
    var msg GossipMessage
    if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
        logging.Debugf("gossip: failed to decode message: %v", err)
        return
    }
    ...
}
```

## Impact

Memory exhaustion kalau message terlalu besar. Bisa menyebabkan OOM.

## Suggested Fix

```
const maxMessageSize = 10 * 1024 * 1024  // 10 MB

func (g *Gossip) gossipHandler(stream network.Stream) {
    ...
    // baca size dulu
    sizeBuf := make([]byte, 8)
    if _, err := io.ReadFull(stream, sizeBuf); err != nil {
        logging.Debugf("gossip: failed to read message size: %v", err)
        return
    }
    size := int64(binary.BigEndian.Uint64(sizeBuf))
    if size > maxMessageSize {
        logging.Warnf("gossip: message too large (%d bytes)", size)
        return
    }

    var msg GossipMessage
    if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
        logging.Debugf("gossip: failed to decode message: %v", err)
        return
    }
    ...
}
```

### Thread

**XE desk**team2026-11-20 00:50 UTCgithub

Thanks for the report. We read it against the code and could not confirm a bug in what it describes.

This report is closed as invalid. If we have missed something, file a new report that links
https://bounty.xe.network/XE-13304 and says what; it is read like any other.
