Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Mar 2003 13:01:01 +0200 (EET)
From:      Andrey Zherebchenko <andy@leman.dn.ua>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/50096: tiff-3.5.7  fax2tiff dumps core
Message-ID:  <200303181101.h2IB11kC083873@roland.leman.dn.ua>

next in thread | raw e-mail | index | archive | help

>Number:         50096
>Category:       ports
>Synopsis:       tiff-3.5.7  fax2tiff dumps core
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 18 07:20:05 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andrey Zherebchenko
>Release:        FreeBSD 4.7-RELEASE-p3 i386
>Organization:
Leman Ukraine
>Environment:
System: FreeBSD roland.leman.dn.ua 4.7-RELEASE-p3 FreeBSD 4.7-RELEASE-p3 #1: Fri Jan 10 09:12:54 EET 2003 andy@roland.leman.dn.ua:/usr/obj/usr/src/sys/ROLAND i386

Checked on several 4.7 systems with tiff-3.5.7

>Description:
	fax2tiff always dumps core even instead of printing usage.

>How-To-Repeat:
	just run fax2tiff with any arguments or without them
>Fix:

	Core dumps caused by SeekFile call in TIFFClientOpen.
	Hhere is tiny patch. 
	It also prevents creating empty fax.tif when running without arguments.


*** fax2tiff.c.orig	Tue Mar 11 15:08:31 2003
--- fax2tiff.c	Tue Mar 11 15:08:44 2003
***************
*** 55,60 ****
--- 55,67 ----
  int	copyFaxFile(TIFF* tifin, TIFF* tifout);
  static	void usage(void);
  
+ static toff_t
+ DummySeekProc(thandle_t fd, toff_t off, int whence)
+ {
+ 	(void) fd; (void) off; (void) whence;
+ 	return (0);
+ }
+ 
  static tsize_t
  DummyReadProc(thandle_t fd, tdata_t buf, tsize_t size)
  {
***************
*** 86,95 ****
  	extern int optind;
  	extern char* optarg;
  
  	/* smuggle a descriptor out of the library */
  	faxTIFF = TIFFClientOpen("(FakeInput)", "w", (thandle_t) -1,
! 				 DummyReadProc, DummyWriteProc,
! 				 NULL, NULL, NULL, NULL, NULL);
  	if (faxTIFF == NULL)
  		return (EXIT_FAILURE);
  	faxTIFF->tif_mode = O_RDONLY;
--- 93,105 ----
  	extern int optind;
  	extern char* optarg;
  
+ 	if (argc <= 1)	
+ 		usage();
+ 
  	/* smuggle a descriptor out of the library */
  	faxTIFF = TIFFClientOpen("(FakeInput)", "w", (thandle_t) -1,
! 				 DummyReadProc, DummyWriteProc, DummySeekProc,
! 				 NULL, NULL, NULL, NULL);
  	if (faxTIFF == NULL)
  		return (EXIT_FAILURE);
  	faxTIFF->tif_mode = O_RDONLY;
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303181101.h2IB11kC083873>