🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.d
Article #656

Another bug in unix lharc corrected

#656
From: Matthieu Herrb
Date: Wed, 28 Mar 1990 08:43
41 lines
1746 bytes
I found another little bug in the unix version of lharc: it dumped
core when extracting files with length zero. 

It is a division by zero in lzhuf.c. Here is the patch:

*** lzhuf.c~	Sun Mar 18 14:59:06 1990
--- lzhuf.c	Wed Mar 28 10:27:48 1990
***************
*** 882,888 ****
  		((size  + (m * INDICATOR_THRESHOLD - 1)) /
  		 (m * INDICATOR_THRESHOLD) *
  		 INDICATOR_THRESHOLD);
! 	i = ((size + (indicator_threshold - 1)) / indicator_threshold);
  	while (i--)
  		putchar (DOT);
  	indicator_count = 0;
--- 882,891 ----
  		((size  + (m * INDICATOR_THRESHOLD - 1)) /
  		 (m * INDICATOR_THRESHOLD) *
  		 INDICATOR_THRESHOLD);
! 	if (indicator_threshold != 0)
! 		i = ((size + (indicator_threshold - 1)) / indicator_threshold);
! 	else
! 		i = 0;
  	while (i--)
  		putchar (DOT);
  	indicator_count = 0;

Hope this helps.

PS: I found better compression rate with lharc than whin tar and
compress which was the best.

					Matthieu Herrb

--
\  /  | Matthieu Herrb             CNRS - LAAS 
|\/|--| matthieu@idefix.laas.fr    7, avenue du Colonel Roche
|  |  |                            31077 Toulouse Cedex - France
"If You're not Part of the Solution, You're Part of the Problem..."
Technical Details
Message-ID: <MATTHIEU.90Mar28104309@castor.laas.fr>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!uwm.edu!zaphod.mps.ohio-state.edu!samsung!think!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!inria!laas!matthieu

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!uwm.edu!zaphod.mps.ohio-state.edu!samsung!think!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!inria!laas!matthieu
From: matthieu@laas.fr (Matthieu Herrb)
Newsgroups: comp.sources.d
Subject: Another bug in unix lharc corrected
Summary: unix lharc dumped core when extracting zero-length files
Message-ID: <MATTHIEU.90Mar28104309@castor.laas.fr>
Date: 28 Mar 90 08:43:09 GMT
Sender: news@laas.laas.fr
Distribution: comp
Organization: LAAS-CNRS France
Lines: 41