commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Doe (JIRA)" <>
Subject [jira] [Created] (COMPRESS-451) IOUtils.copy hangs with misconfigured or corrupted inputs
Date Thu, 03 May 2018 21:50:00 GMT
John Doe created COMPRESS-451:

             Summary: IOUtils.copy hangs with misconfigured or corrupted inputs
                 Key: COMPRESS-451
             Project: Commons Compress
          Issue Type: Bug
    Affects Versions: 1.0
            Reporter: John Doe

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 = {// returns 0 when buffer.length==0
            output.write(buffer, 0, n);
            count += n;
        return count;

This message was sent by Atlassian JIRA

View raw message