sunng87 / pgwire

PostgreSQL wire protocol implemented as a rust library.
Apache License 2.0
511 stars 36 forks source link

Fix SASL body decode #175

Closed wyhaya closed 5 months ago

wyhaya commented 5 months ago
let mut bytes = BytesMut::new();
PgWireBackendMessage::Authentication(Authentication::SASLFinal(Bytes::from("Hello")))
        .encode(&mut bytes);
// Panic !!!
PgWireBackendMessage::decode(&mut bytes);

Error

thread 'main' panicked at /Users/.../bytes-1.6.0/src/bytes_mut.rs:386:9:
split_to out of bounds: 9 <= 5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
sunng87 commented 5 months ago

Thank you!