Description:
I encountered an issue with the input handling in the system using the following test code. The problem occurs under the following scenarios:
When the input buffer length exceeds 8192 bytes, the read operation only retrieves 8192 bytes of data.
When the input length buffer exceeds 24576 bytes, the program enters an infinite wait with no output and does not exit.
Steps to Reproduce:
Use the provided test code.
Run the code with an input bufferlength of 16384 bytes.
Observe that the read operation retrieves only 8192 bytes.
Increase the input bufferlength to exceed 24576 bytes.
Observe that the program enters an infinite wait with no output and does not exit.
Expected Behavior:
The buffer and echo should be equal, meaning the data written should match the data read without any loss or corruption.
Test Code:
use std::io::{BufReader, Read, Write};
use std::net::TcpStream;
fn main() -> std::io::Result<()> {
let mut stream = BufReader::new(TcpStream::connect("cat")?);
let buffer = vec![0x12; 16384];
stream.get_mut().write_all(buffer.as_ref())?;
let mut echo = vec![0u8; 16384];
let mut b = BufReader::new(stream);
b.read(&mut echo)?;
let mut i = 0;
for v in echo {
if v == 0u8 {
println!("index: {:?}", i);
break;
}
i += 1;
}
Ok(())
}
https://github.com/fortanix/rust-sgx/blob/b6f0262614ce1574b7d66226b68d7247b822d860/examples/usercall-extension/app/src/main.rs#L5-L12
Description: I encountered an issue with the input handling in the system using the following test code. The problem occurs under the following scenarios:
buffer
length exceeds 8192 bytes, the read operation only retrieves 8192 bytes of data.buffer
exceeds 24576 bytes, the program enters an infinite wait with no output and does not exit.Steps to Reproduce:
Use the provided test code.
buffer
length of 16384 bytes.buffer
length to exceed 24576 bytes.Expected Behavior:
buffer
andecho
should be equal, meaning the data written should match the data read without any loss or corruption.Test Code: