Skip to content

Track the 'frame' position for protocol sync purposes #3775

@NinoFloris

Description

@NinoFloris

As discussed offline it would be good to reduce the opportunities for bugs like #3771 to sneak in.

The idea is to add a 'frame' position (any backend message starts a frame with the size of length) to ReadBuffer, this will likely require adding a cumulative frame position to span read buffer resets.

Once we have this data we could do a few things:

  • During read calls we could assert whether the asked for length makes any sense within the total frame size.
  • Before processing a backend message we capture the current cumulative read position and after processing we check whether the current position is between that + frame length. If not we break the connector with a descriptive message in the spirit of "Lost sync somewhere after last message code: {messageCode}, read {diff} bytes out of frame bounds {length}, report a bug".

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions