Example of a tar file showing this problem:

Patch providing a possible fix: