Uploaded image for project: 'Maven Wagon'
  1. Maven Wagon
  2. WAGON-485

ScpWagon parses file size to int causing overflow for large files

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.10
    • Fix Version/s: 2.12
    • Component/s: wagon-ssh
    • Labels:
      None

      Description

      ScpWagon class parses a string value to integer (file size) but if you have a large file (3.6 GB for example) the file size is 3865470566 in bytes, the number is larger than the MAX_VALUE of integer.

      ScpWagon.java
      public void fillInputData( InputData inputData )
              throws TransferFailedException, ResourceDoesNotExistException {
      ...
      int filesize = Integer.valueOf( line.substring( 5, index ) ).intValue();
      fireTransferDebug( "Remote file size: " + filesize );
      
      resource.setContentLength( filesize );
      ...
      

      I changed the line to parse using Long because the resource.setContentLength method receive a long value too.

      ScpWagon.java
      long filesize = Long.valueOf( line.substring( 5, index ) );
      

      Please check the pull-request https://github.com/apache/maven-wagon/pull/32

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael-o Michael Osipov
                Reporter:
                assuncao.s Silvio Assuncao
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: