Bug 89938 - compress causes Segmentation fault
Summary: compress causes Segmentation fault
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: ncompress
Version: 9
Hardware: i686
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-30 00:30 UTC by Patrick Melo
Modified: 2007-04-18 16:53 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-23 11:36:22 UTC
Embargoed:


Attachments (Terms of Use)

Description Patrick Melo 2003-04-30 00:30:32 UTC
Description of problem:

The compress command seems to be having trouble compressing files.  If I try 
to compress a 1G file the commands produces a return value of 2 and no 
compressed file is created.  If I try to compress a 2G file, a compressed file 
is created but the command also seems to generate a 'Segmentation fault'.  I 
am running 'Red Hat Linux release 9 (Shrike)' which comes with ncompress-4.2.4-
33.

[patrick@sprout tmp]$ dd if=/dev/urandom of=large bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
[patrick@sprout tmp]$ ls -lh
total 1.1G
-rw-------    1 patrick  patrick      1.0G Apr 29 16:32 large
[patrick@sprout tmp]$ compress large
[patrick@sprout tmp]$ echo $?
2
[patrick@sprout tmp]$ ls -lh
total 1.1G
-rw-------    1 patrick  patrick      1.0G Apr 29 16:32 large
[patrick@sprout tmp]$ cat large large > xlarge
[patrick@sprout tmp]$ ls -lh
total 3.1G
-rw-------    1 patrick  patrick      1.0G Apr 29 16:32 large
-rw-------    1 patrick  patrick      2.0G Apr 29 16:47 xlarge
[patrick@sprout tmp]$ compress xlarge
Segmentation fault
[patrick@sprout tmp]$ echo $?
139
[patrick@sprout tmp]$ ls -lh
total 5.5G
-rw-------    1 patrick  patrick      1.0G Apr 29 16:32 large
-rw-------    1 patrick  patrick      2.0G Apr 29 16:47 xlarge
-rw-------    1 patrick  patrick      2.5G Apr 29 17:08 xlarge.Z
[patrick@sprout tmp]$

Version-Release number of selected component (if applicable):
ncompress-4.2.4-33

How reproducible:
Every time

Steps to Reproduce:
1. dd if=/dev/urandom of=large bs=1024
2. cat large large > xlarge
3. compress xlarge
    
Actual results:
xlarge.Z is created and Segmentation fault is displayed

Expected results:
Segmentation fault should not have occurred

Additional info:

Comment 1 David Hull 2003-07-14 23:21:40 UTC
I e-mailed the following patch to ncompress not long ago but didn't
receive a reply.  I suspect that this might fix the segmentation fault
problem, at least.

From: David Hull <hull>
To: teg
Subject: ncompress 32-bit bug
Date: Thu, 29 May 2003 16:22:28 -0700

The compress application that comes with Red Hat Linux 7.3 (and 9 as
well) had a problem compressing a large (>2GB) file.  This is version
ncompress-4.2.4-28.

The attached patch fixes the problem for me.  (I'm sending this to you
because you entered the last entry in the RPM .spec file.)
-- 
David Hull

--- compress42.c.orig    Thu May 29 12:02:53 2003
+++ compress42.c        Thu May 29 15:43:27 2003
@@ -1355,7 +1355,7 @@
                REG11   int                     boff;
                REG12   int                     n_bits;
                REG13   int                     ratio;
-               REG14   long            checkpoint;
+               REG14   long long       checkpoint;
                REG15   code_int        extcode;
                union
                {


Comment 2 Jeff Johnson 2004-08-23 11:36:22 UTC
Fixed in latest ncompress.


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