Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-385

FileUtils.doCopyFile can potentially loop for ever

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.5
    • None
    • None

    Description

      FileUtils.doCopyFile caches the input file size and only exits the loop once it has read sufficient bytes.

      If the input file is truncated after obtaining the file size, the loop might never exit.

      One possible way round this might be to check whether anything has been transferred. However, I don't know if it's possible for FileChannel.transferFrom() to temporarily return 0 when there is data available; if so that could cause some existing applications to break.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment