From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP  2-SEP-1988 23:25
To:	ARISIA::EVERHART
Subj:	Lempel-Ziv compression utility - bug fixes for VAX/VMS version"


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri,  2 SEP 88 14:41:10 PDT
Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Fri, 2 Sep 88 14:17:56 PDT
Received: from UKACRL.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 8551; Fri, 02 Sep 88 17:08:48 EDT
Received: from RL.IB by UKACRL.BITNET (Mailer X1.25) with BSMTP id 1895; Fri,
 02 Sep 88 22:07:04 BST
Received: from RL.IB by UK.AC.RL.IB (Mailer X1.25) with BSMTP id 1893; Fri, 02
          Sep 88 22:07:03 BS
Via:      UK.AC.KCL.CC.OAK;  2 SEP 88 22:07:00 BST
Date:     2-SEP-1988 22:07:44 GMT
From:     UDAA055%OAK.CC.KCL.AC.UK@CUNYVM.CUNY.EDU
To:       info-vax@KL.SRI.COM
Subject:  Lempel-Ziv compression utility - bug fixes for VAX/VMS version"
Sender:   Andy Harper, Kings College London <A.Harper%OAK.CC.KCL.AC.UK@CUNYVM.CUNY.EDU>

Dear All,

In attempting to get the Lempel-Ziv compression utility running correctly
under VMS, I discovered some bugs. Specifically, because of a problem with the
use of the 'realloc' function,  the space for the output filename was being
overwritten resulting in the creation of 'null' filenames. This only happened
under certain obscure conditions, seemingly related to the use of the -V
option.  Enclosed are two DIFF listings for the two relevant files indicating
the fixes applied to the original sources (also including incidentally, the
fixes posted by an earlier infovaxer!)

Regards,

Andy Harper
Kings College London

PS if anyone can explain WHY the original use of 'realloc' was faulty, please
let me know. It took the debugger (more specifically the SET WATCH command) to
tell me how (but not why) the space was being overwritten!


LZCMP1.C  DIFFS:


************
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZCMP1.C;14
  796           if (verbose > 1) $
  797           fprintf(stderr, "FDL information for \"%s\"\n", fname);
  798           fdl_dump(&fdl_descriptor, stderr);
******
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZCMP1.C;1
  796           infilename = malloc(256 + 1);
  797           infilename = realloc(fname, strlen(fname) + 1);
  798           if (verbose > 1) $
  799           fprintf(stderr, "FDL information for \"%s\"\n", filename);
  800           fdl_dump(&fdl_descriptor, stderr);
************

Number of difference sections found: 1
Number of difference records found: 4

DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRAT
    DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZCMP1.C;14-
    DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZCMP1.C;1


LZVIO.C  DIFF'S   (these were originally posted by another infovaxer...)


************
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;6
  210           fdl_descriptor->dsc$w_length = 0;
  211           fdl_descriptor->dsc$b_dtype = DSC$K_DTYPE_VT;
  212           fdl_descriptor->dsc$b_class = DSC$K_CLASS_D;
  213           fdl_descriptor->dsc$a_pointer = 0;
  214           fab_add = &r->fab;
******
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;1
  210           fdl_descriptor->dsc$w_length = 4096;
  211           fdl_descriptor->dsc$b_dtype = DSC$K_DTYPE_VT;
  212           fdl_descriptor->dsc$b_class = DSC$K_CLASS_D;
  213           fdl_descriptor->dsc$a_pointer = malloc(4096);
  214           fab_add = &r->fab;
************
************
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;6
  232           fdl_descriptor->dsc$w_length = retlen;
******
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;1
  232           fdl_descriptor->dsc$a_pointer
  233           = realloc(fdl_descriptor->dsc$a_pointer, retlen + 1);
  234           fdl_descriptor->dsc$w_length = retlen;
************
************
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;6
  344       r->nam.nam$b_ess = NAM$C_MAXRSS;    /* ... size        */
  345       r->nam.nam$b_rss = NAM$C_MAXRSS;    /* ... max size        */
  346       if ((fdl_status = sys$parse(&r->fab)) != RMS$_NORMAL) $
******
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;1
  346       r->nam.nam$b_ess = NAM$C_MAXRSS + 1;    /* ... size        */
  347       r->nam.nam$b_rss = NAM$C_MAXRSS + 1;    /* ... max size        */
  348       if ((fdl_status = sys$parse(&r->fab)) != RMS$_NORMAL) $
************
************
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;6
  355
  356   fdl_free(fdl_descriptor)
******
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;1
  357
  358   fdl_free(fdl_descriptor)
************
************
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;6
  363           str$free1_dx(fdl_descriptor);
  364           fdl_descriptor->dsc$a_pointer = NULL;
******
File DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;1
  365           free(fdl_descriptor->dsc$a_pointer);
  366           fdl_descriptor->dsc$a_pointer = NULL;
************

Number of difference sections found: 5
Number of difference records found: 10

DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRAT
    DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;6-
    DISK$COMPCENT:[UDAA055.PD.LEMPELZIV.SCRATCH]LZVIO.C;1

