Merge "Fix buffer overflow when the last chunk is 4kb"