We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4398afe commit 83405a5Copy full SHA for 83405a5
src/server/encode.rs
@@ -255,8 +255,8 @@ impl Encoder {
255
let buf_len = buf.len().checked_sub(self.bytes_read).unwrap_or(0);
256
let amt = src.len().min(buf_len);
257
// Calculate the max char count encoding the `len_prefix` statement
258
- // as hex would take. This is done by rounding up `log16(amt)`.
259
- let hex_len = (amt as f64).log(16.0).ceil() as usize;
+ // as hex would take. This is done by rounding up `log16(amt + 1)`.
+ let hex_len = ((amt + 1) as f64).log(16.0).ceil() as usize;
260
let crlf_len = 2 * 2;
261
let buf_upper = buf_len.checked_sub(hex_len + crlf_len).unwrap_or(0);
262
let amt = amt.min(buf_upper);
0 commit comments