Project

General

Profile

Bug #9529

TarHeader (Gem::Package) doesn't parse size correctly for +8GB entries

Added by eranhirsch (Eran Hirsch) over 5 years ago. Updated 20 days ago.

Status:
Third Party's Issue
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin13.0.0]
Backport:
[ruby-core:94060]

Description

  • The current TAR header parsing code assumes the size is represented as an octal string
  • Because this is a 12-byte, null-terminated field, effectively this can represent up to 8GB (811).
  • For bigger files the standard allows to define the field as a 12-byte INTEGER instead.
  • When using this form, the first bit of the field should be turned on to signal that it is used.

Currently, TAR files containing files larger then 8GB in this format would fail parsing because size would be computed as 0.

(Wiki with some description of the logic, couldn't find a more "formal" document: http://en.wikipedia.org/wiki/Tar_(computing)#File_header)

The problem is with this code:
http://yard.ruby-doc.org/stdlib-2.1.0/Gem/Package/TarHeader.html#from-class_method

The line that assigns the value to size should be conditioned on the value of the first bit, and should treat the two cases differently

History

Updated by luislavena (Luis Lavena) over 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to drbrain (Eric Hodel)

Updated by ruby_learner (Jay Mav) about 2 months ago

Hello,
Is there plan to fix this issue? Need this Windows because there is no native support for extracting tar contents. Is there any workaround for is there any other rubygem which can extract archived_file >= 8gb?
Thanks.

Updated by hsbt (Hiroshi SHIBATA) 20 days ago

  • Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN)
  • Assignee changed from drbrain (Eric Hodel) to hsbt (Hiroshi SHIBATA)
  • Status changed from Assigned to Third Party's Issue

I'm not sure what usecase of this issue.

Can you file the details into the upstream repository? https://github.com/rubygems/rubygems

Thanks.

Also available in: Atom PDF