Bug 104845

Summary: [patch] Build error on contrib/file/magic(5)
Product: Base System Reporter: Ryoji Kanai <kanai>
Component: binAssignee: Antoine Brodin <antoine>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Ryoji Kanai 2006-10-27 03:00:35 UTC
I can't build libmagic due to a bug in "magic" program. It seems to be a
overflow type bug and I always got a segmentation fault when I'm doing
"make buildworld". The problem is in contrib/file/apprentice.c.

Fix: I GDBed the magic program and found this. I'm not sure this is the right
way to fix it.

angelfish:file> diff -u apprentice.c.orig apprentice.c
How-To-Repeat: make buildworld

That's it. You should get a Segmentation fault. Is this only me?
Comment 1 Kris Kennaway 2006-10-27 05:38:42 UTC
On Fri, Oct 27, 2006 at 01:51:22AM +0000, Ryoji Kanai wrote:

> That's it. You should get a Segmentation fault. Is this only me?

Maybe.  There was a segfault fix to this file 4 months ago, can you
please confirm that you have it?

> >Fix:
> I GDBed the magic program and found this. I'm not sure this is the right way to fix it.

You could also check with the authors.

Kris
Comment 2 Ryoji Kanai 2006-10-27 20:58:45 UTC
At Fri, 27 Oct 2006 00:38:42 -0400,
Kris Kennaway wrote:

> > That's it. You should get a Segmentation fault. Is this only me?
> 
> Maybe.  There was a segfault fix to this file 4 months ago, can you
> please confirm that you have it?

My fix is another problem. The problem exists even in the latest code.

> > >Fix:
> > I GDBed the magic program and found this. I'm not sure this is the right way to fix it.
> 
> You could also check with the authors.

I talked with Christos Zoulas (maintainer). He said this was a bug
and he fixed it. I hope new version will be released soon. Anyway, you
can close this pr and set a "should update contrib/file to the next
version" flag.

Thanks!
Comment 3 Kris Kennaway 2006-10-27 21:42:58 UTC
On Fri, Oct 27, 2006 at 12:58:45PM -0700, Ryoji Kanai wrote:
> 
> At Fri, 27 Oct 2006 00:38:42 -0400,
> Kris Kennaway wrote:
> 
> > > That's it. You should get a Segmentation fault. Is this only me?
> > 
> > Maybe.  There was a segfault fix to this file 4 months ago, can you
> > please confirm that you have it?
> 
> My fix is another problem. The problem exists even in the latest code.
> 
> > > >Fix:
> > > I GDBed the magic program and found this. I'm not sure this is the right way to fix it.
> > 
> > You could also check with the authors.
> 
> I talked with Christos Zoulas (maintainer). He said this was a bug
> and he fixed it. I hope new version will be released soon. Anyway, you
> can close this pr and set a "should update contrib/file to the next
> version" flag.

Interesting, I wonder why others aren't seeing it.  Do you have
nonstandard MALLOC_OPTIONS (or /etc/malloc.conf)?

If Christos has imported the fix, we can also do a vendor import of
just your patch into FreeBSD since it won't cause a divergence from
vendor code.

Kris
Comment 4 Ryoji Kanai 2006-10-28 01:29:42 UTC
> Interesting, I wonder why others aren't seeing it.  Do you have
> nonstandard MALLOC_OPTIONS (or /etc/malloc.conf)?

Yeah, it's wired. I don't have malloc.conf and any MALLOC*
options. But, check the code. This is a bug.

> If Christos has imported the fix, we can also do a vendor import of
> just your patch into FreeBSD since it won't cause a divergence from
> vendor code.

I think he has imported. I sent the same patch that I sent with this
pr. And, he simply said 

At Fri, 27 Oct 2006 10:57:58 -0400,
Christos Zoulas wrote:

> You are absolutely right; I just fixed it.
> 
> Thanks,
> 
> christos

If you can import my patch, that would be great.

-- Ryoji
Comment 5 Antoine Brodin freebsd_committer freebsd_triage 2008-03-19 19:20:33 UTC
State Changed
From-To: open->feedback

Dear submitter, file version 4.23 has been imported in freebsd 
and merged to RELENG_7 and RELENG_6. 
Can you confirm it fixes your problem? 
Thanks. 


Comment 6 Antoine Brodin freebsd_committer freebsd_triage 2008-03-19 19:20:33 UTC
Responsible Changed
From-To: freebsd-bugs->antoine

Track.
Comment 7 Antoine Brodin freebsd_committer freebsd_triage 2008-04-19 10:04:50 UTC
State Changed
From-To: feedback->closed

Close: I believe this is fixed + feedback timeout (1 month).