You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TarReader rejects valid GNU sparse format 1.0 (PAX) entries whose embedded sparse map is longer than about 1 KiB. Reading the entry's DataStream, or extracting it with TarFile.ExtractToDirectory, throws InvalidDataException: The TAR archive is corrupted or invalid.. GNU tar writes such maps for any moderately fragmented sparse file: a file with 76 data regions already produces a 1062-byte map.
Reproduction Steps
usingSystem;usingSystem.Formats.Tar;usingSystem.IO;// Both archives were written by tar (--format=pax --sparse --sparse-version=1.0).foreach(stringpathinnew[]{"sparse72.tar","sparse76.tar"}){stringdir=Directory.CreateTempSubdirectory().FullName;try{TarFile.ExtractToDirectory(path,dir,overwriteFiles:true);Console.WriteLine($"{path}: OK");}catch(Exceptionex){Console.WriteLine($"{path}: {ex}");}finally{Directory.Delete(dir,recursive:true);}}
The GNU sparse 1.0 format specification does not limit the sparse map size
we added some hard cap as a sort of DoS protection (loading the sparse table results in attacker-controlled allocation), I think we can make the cap a bit bigger
Activity
dotnet-policy-service commentedon Sep 30, 2026
Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Oct 12, 2026
Tagging subscribers to this area: @dotnet/area-system-formats-tar
See info in area-owners.md if you want to be subscribed.
rzikm commentedon Oct 12, 2026
we added some hard cap as a sort of DoS protection (loading the sparse table results in attacker-controlled allocation), I think we can make the cap a bit bigger
rzikm commentedon Oct 12, 2026
@jeffhandley is there a specific reason why you assigned this to 11.0.0 milestone? is it critical to fix there?
Fix GNU sparse 1.0 maps spanning multiple TAR records (#135626)