Fix buffersize may smaller than the input files
am: d649a58ab6

Change-Id: I91033a5c3aca572d73f06cdfbd79eecf6c85e0b3