0.7.0-rc.2 issue: "invalid utf-8 sequence of 1 bytes from index 34"
elimirks opened this issue · 3 comments
elimirks commented
Version: 0.7.0-rc.2
I'm getting this error for a cypher query returning a lot of rows:
unexpected response for PULL: Err(DeserializationError(Other("invalid utf-8 sequence of 1 bytes from index 34")))
Seems to stem from line 81 in stream.rs
.
elimirks commented
async fn read_chunk(&mut self, chunk_size: usize, buf: &mut BytesMut) -> Result<()> {
let pos = buf.len();
buf.resize(pos + chunk_size, 0);
self.stream.read_exact(&mut buf[pos..]).await?;
return Ok(());
// This is an unsafe variant of doing the following
// but skips the zero-initialization of the buffer
//
// let pos = bytes.len();
// bytes.resize(pos + chunk_size, 0);
// self.stream.read_exact(&mut bytes[pos..]).await?;
//
// Alternatively, this an unsafe variant of the following except
// it does read extactly `chunk_size` bytes and not maybe more
//
// bytes.reserve(chunk_size);
// self.stream.read_buf(&mut bytes).await?;
Seems the unsafe version of this code is breaking something, doing this (as the comment suggested is safe) works fine