Bug 64869 - tar segmentation fault when the TAR_OPTIONS environment variable is set
tar segmentation fault when the TAR_OPTIONS environment variable is set
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: tar (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-13 16:12 EDT by F Harvell
Modified: 2007-04-18 12:42 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-03-08 09:01:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Fixes null termination of argv. (696 bytes, patch)
2002-06-16 12:36 EDT, Olivier Baudron
no flags Details | Diff

  None (edit)
Description F Harvell 2002-05-13 16:12:38 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020510

Description of problem:
The tar program seg faults when the TAR_OPTION environment variable is set.

It appears that the issue may rest within libc as copying the RH 7.2 version of
the tar executable also fails. It used to work prior to upgrading from RedHat
7.2 to RedHat 7.3.

Version-Release number of selected component (if applicable):
tar-1.13.25-4
glibc-2.2.5-34

How reproducible:
Always

Steps to Reproduce:
1.export TAR_OPTIONS="-v"
2.tar xvf /some/tar/file.tar
	

Actual Results:  generates "Segmentation fault".

Expected Results:  tar listing

Additional info:

It appears that the issue may rest within libc as copying the RH 7.2 version of
the tar executable also fails.

It used to work prior to upgrading from RedHat 7.2 to RedHat 7.3.

It currently fails on both an Athlon and a Pentium III.
Comment 1 F Harvell 2002-05-13 16:24:39 EDT
The problem does not seem to appear when untaring a gzipped tar file:

1. export TAR_OPTIONS="-v"
2. tar tvf /some/tar/file.tar
generates "Segmentation fault".

1. export TAR_OPTIONS="-v"
2. tar tvzf /some/gzipped/tar/file.tar.gz
generates tar file listing as expected.
Comment 2 Bernhard Rosenkraenzer 2002-05-21 10:47:03 EDT
Looks like a glibc problem... 
#0  0x4206d6f5 in _int_malloc () from /lib/i686/libc.so.6 
#1  0x4206cb25 in malloc () from /lib/i686/libc.so.6 
#2  0x0804b126 in strcpy () 
#3  0x08050638 in strcpy () 
#4  0x0805da9d in strcpy () 
#5  0x42016714 in __libc_start_main () from /lib/i686/libc.so.6 
Comment 3 Jakub Jelinek 2002-05-21 11:00:22 EDT
Beg to disagree. Try:
ulimit -c unlimited
LD_PRELOAD=/usr/lib/libefence.so.0 TAR_OPTIONS=-v /bin/tar xvf foo.tar
gdb /bin/tar core
Comment 4 Olivier Baudron 2002-06-16 12:33:58 EDT
The problem is at prepargs.c:92

      while ((*pp++ = *argv++))
	continue;

This code requires that argv[argc]==NULL. Normally this is a K&R standard, but
argv has been (badly) overwritten, and does not respect this restriction at that
moment.

The following patch fixes the problem.
Comment 5 Olivier Baudron 2002-06-16 12:36:54 EDT
Created attachment 61084 [details]
Fixes null termination of argv.
Comment 6 Bernhard Rosenkraenzer 2002-07-01 09:45:20 EDT
Fixed in 1.13.25-6
Comment 7 Miloslav Trmac 2004-03-08 09:01:12 EST
Fix confirmed in tar-1.13.25-12.

Note You need to log in before you can comment on or make changes to this bug.