Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.0
-
None
-
None
Description
When the buffersize is misconfigured or corrupted, i.e., 0, the while loop in IOUtils.copy() function hangs endlessly. Here is the code snippet.
public static long copy(final InputStream input, final OutputStream output, int buffersize) throws IOException { final byte[] buffer = new byte[buffersize];//buffersize is misconfigured or corrupted int n = 0; long count=0; while (-1 != (n = input.read(buffer))) {//input.read returns 0 when buffer.length==0 output.write(buffer, 0, n); count += n; } return count; }