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
@rzikm I had missed this notification. I included this in the 11.0.0 milestone since it was related to new functionality in .NET 11, with a customer-reported issue against it. When feasible, it's valuable to fix issues in the same release as the feature was introduced. Issues that meet the servicing bar generally also meet the GA bar before code complete.
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)
jeffhandley commentedon Oct 24, 2026
@rzikm I had missed this notification. I included this in the 11.0.0 milestone since it was related to new functionality in .NET 11, with a customer-reported issue against it. When feasible, it's valuable to fix issues in the same release as the feature was introduced. Issues that meet the servicing bar generally also meet the GA bar before code complete.