helpGNU tar - Support: sr #106350, patch: large files may be...

 
 

sr #106350: patch: large files may be corrupted when added in sparse mode

Submitted by:  None
Submitted on:  Thu 24 Apr 2008 05:58:35 PM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 24 Apr 2008 05:58:35 PM UTC, original submission:

Reproducer and patch for 1.20 are attached. Edit TAR variable to point to any tar executable. Reproducer should be run in empty directory, it does the following:

Create file with the following contents:
- 1M hole
- 5000M of "A"s
- 999M hole
Tar it, untar it, and it becomes:
- 1M hole
- 4096M hole <- this is introduced by bug
- 5000-4096M of "A"s
- 999M hole

During archive creation, large block of data in sparse map is overflowing size_t numbytes element of struct sp_array and corrupted file is stored in tar archive (zero block instead of first 4Gb of data block).
Instead of changing size_t to off_t for numbytes and other variables, I thought we should better split large data blocks in pieces smaller than 4Gb. Actually, I didn't think much on changing size_t to off_t since I'm not too familiar with the code, you may prefer that way.

IMHO it's important to use 0xffffffff instead of any "portable" defines, to ensure that archive created on 64bit computer (where size_t is 8 bytes) will not have data block in sparse map bigger than 4G, and thus could be unpacked by tar on 32bit computer.

Probably tar_sparse_scan() must also be called inside conditional, I can't check this because it's not implemented/documented and I don't know what it should do.

Thank you.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #15517:  reproducer added by None (734B - application/octet-stream)
file #15518:  tar-1.20-sparse.patch added by None (639B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 24 Apr 2008 05:58:35 PM UTCNoneAttached File-=>Added reproducer, #15517
      Attached File-=>Added tar-1.20-sparse.patch, #15518

    Back to the top


    Powered by Savane 3.1-cleanup