Oh right, this is a dynamic buffer. Perhaps you could put a min(… , bufferLimit) around the allocation size too.

I think we should also fail early for non-final frames when `frame.getBinaryData.readableBytes() > bufferLimit`, so maybe you could put another guard case up at the top of the match expressions?

````scala
case (frame, _) if !frame.isFinalFragment && frame.getBinaryData.readableBytes() > bufferSize =>
  closeWebSocket(ctx, WebSocketMessageTooLong, "Fragmented message too long, configured limit is " + bufferLimit)
````