Fix race condition in zero-copy mode of BufferedData input