Bug 106858

Summary: Extracted mime part of spam email makes file(1) dump core
Product: Base System Reporter: Peter Olsson <pol>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.1-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
p001.uu
none
Re: Bug in amavisd-new? none

Description Peter Olsson 2006-12-18 10:00:22 UTC
A spam email had its parts extracted via amavisd-new. The first part,
text only, made file dump core. This caused amavisd-new to repeat the
extraction process and file dumped core again and so on until the
partition was filled. The extracted file is only 937 byte, so there
must be some pattern in there that file has problems with. How do I
give you the problem file? Should I email it somewhere as an encrypted
zip file?

How-To-Repeat: Run file on the file.
Comment 1 joseph.koshy 2006-12-18 10:10:40 UTC
> How do I give you the problem file? Should I email it somewhere > as an encrypted zip file?

You could use uuencode(1) and send it in as an attachment to
this PR.
Comment 2 Peter Olsson 2006-12-18 10:36:19 UTC
UUencoded problem file attached. Run file on the extracted file to
cause the core dump. I have tried this in 6.1-RELEASE-p11 and
6.1-RELEASE-p10, core dump in both.

However, in 4.11-RELEASE-p26, I get this result:
$ file p001
p001: ASCII English text

-- 
Peter Olsson                    pol@leissner.se
Comment 3 Remko Lodder freebsd_committer freebsd_triage 2006-12-18 11:03:07 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-ports-bugs

Reassign to the ports team, this seems amavisd-new related.
Comment 4 Gabor Kovesdan freebsd_committer freebsd_triage 2006-12-18 12:29:02 UTC
I attached the author's answer. Could you check your file utility and if 
it's old, try with a newer one, please?

Cheers,
Gabor
Comment 5 Peter Olsson 2006-12-18 13:15:46 UTC
On Mon, 18 Dec 2006 13:29 +0100, Gabor Kovesdan wrote:

> I attached the author's answer. Could you check your file utility and if it's 
> old, try with a newer one, please?
>
> Cheers,
> Gabor

Ok, file is at version 4.12 in 6.1-RELEASE-p11.
I have tried with version 4.19 from ftp.astron.com,
and that version does not dump core on the problem file.

But I now have /usr/local/bin/file at 4.19 and /usr/bin/file
at 4.12. What do I have to do to make the entire FreeBSD system
use /usr/local/bin/file (and the associated magic files of the
correct version) instead of /usr/bin/file? I can't move away from
x.x-RELEASE-pxx because of upgrading policy on production servers.
This goes beyond my usual cvsup, make buildworld/buildkernel/
installkernel/installworld cycle. Should I put all files from
file-4.19.tar into /usr/src/contrib/file and then run a make
buildworld and make installworld?

I'm sorry if this is too much of a beginners question, please
attach some URL or some relevant search phrase to any RTFM:s.

Thanks!

-- 
Peter Olsson                    pol@leissner.se
Comment 6 Mark.Martinec 2006-12-18 13:40:07 UTC
I tried the sample on a couple of platforms:

/usr/bin/file(1)
version 
4.12   i386  6.1-RELEASE-p3  SIGSEGV
4.12   i386  6.1-RELEASE-p9  SIGSEGV
4.12   i386  6.0-RELEASE-p14 SIGSEGV
4.12   amd64 6.1-RELEASE-p7  Windows Enhanced Metafile (EMF) ...
4.12   amd64 FreeBSD 6.2-RC1 Windows Enhanced Metafile (EMF) ...
4.12   amd64 6.1-RELEASE-p9  Windows Enhanced Metafile (EMF) ...

(file-4.18 and 4.19 work fine on all platforms)

I recommend to use file(1) from ports for amavisd-new
and similar content filters that rely on an up-to-date
and stable version of file(1). The last SEGV I heard of
was on 4.16.
Comment 7 Gabor Kovesdan freebsd_committer freebsd_triage 2006-12-18 15:16:32 UTC
> But I now have /usr/local/bin/file at 4.19 and /usr/bin/file
> at 4.12. What do I have to do to make the entire FreeBSD system
> use /usr/local/bin/file (and the associated magic files of the
> correct version) instead of /usr/bin/file? I can't move away from
> x.x-RELEASE-pxx because of upgrading policy on production servers.
> This goes beyond my usual cvsup, make buildworld/buildkernel/
> installkernel/installworld cycle. Should I put all files from
> file-4.19.tar into /usr/src/contrib/file and then run a make
> buildworld and make installworld?

I suggest you just deleting /usr/bin/file and symlinking 
/usr/local/bin/file there. That's the simplest solution.

Cheers,
Gabor
Comment 8 Tilman Keskinoz freebsd_committer freebsd_triage 2006-12-18 15:26:10 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-bugs

Follow-ups indicate that it is a problem of file(1)
Comment 9 Antoine Brodin freebsd_committer freebsd_triage 2008-05-16 19:17:19 UTC
State Changed
From-To: open->closed

Close: this problem is fixed in file(1) version 4.23. 
(merged in RELENG_6 and RELENG_7)