Yuli Khodorkovskiy
033ca7d47f
Fix unexpected EOF failure for StartupMessage
2021-07-07 18:10:44 -05:00
Jack Christensen
aaef9bbc35
Merge branch 'master' into backend-unexpected-eof
2021-07-06 20:07:55 -05:00
Yuli Khodorkovskiy
2d3823838e
Perform StartupMessage length validation
...
PG provides a maximum size for a StartupMessage:
https://doxygen.postgresql.org/pqcomm_8h.html#a4c50c668c551887ac3a49872130349e3
Limiting the size ensures a malicious user doesn't send an
overwhelmingly large StartupMessage which could DOS a Go binary that
uses pgproto3.
2021-07-06 20:01:33 -05:00
Yuli Khodorkovskiy
10c6c50ac9
Extend handling of unexpected EOF to the backend
...
In the original issue [1] and commit [2], support for unexpected EOF was
added to the frontend to detect when a connection was closed abruptly.
Additionally, this allows us to differentiate normal io.EOF errors with
unexpected errors in the backend.
[1] https://github.com/jackc/pgx/issues/662/
[2] https://github.com/jackc/pgproto3/commit/595780be0f9f581451a23a5151b77f782202ad72
2021-07-01 17:53:14 -04:00
Jack Christensen
439ea11d47
NewFrontend and NewBackend cannot fail
2019-08-31 14:49:55 -05:00
Jack Christensen
c116219b62
Update tests to use v2
2019-04-20 13:01:11 -05:00
Jack Christensen
bb06e6b3ff
Decouple github.com/jackc/chunkreader
2019-03-30 12:46:56 -05:00
Jack Christensen
16176b5151
Add go module support
2019-03-30 12:26:24 -05:00
Jack Christensen
b3d0cbd0e6
Fix reading interrupted messages
...
When an message is received and a timeout occurs after reading the
header but before reading the entire body the connection state could
be corrupted due to the header being consumed. The next read would
consider the body of the previous message as the header for the next.
fixes #348
2017-12-16 13:45:22 -06:00