NetBSD Problem Report #57738

From www@netbsd.org  Fri Dec  1 18:12:40 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2C3291A9239
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  1 Dec 2023 18:12:40 +0000 (UTC)
Message-Id: <20231201181208.C786A1A9239@mollari.NetBSD.org>
Date: Fri,  1 Dec 2023 18:12:08 +0000 (UTC)
From: scole@sdf.org
Reply-To: scole@sdf.org
To: gnats-bugs@NetBSD.org
Subject: file command getting overflow message
X-Send-Pr-Version: www-1.0

>Number:         57738
>Category:       bin
>Synopsis:       file command getting overflow message
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    christos
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 01 18:15:00 +0000 2023
>Closed-Date:    Sat Jan 27 03:17:25 +0000 2024
>Last-Modified:  Sat Jan 27 06:50:02 +0000 2024
>Originator:     scole
>Release:        10.0_RC1
>Organization:
>Environment:
NetBSD dstar.dstar.net 10.0_RC1 NetBSD 10.0_RC1 (GENERIC) #0: Sun Nov 12 11:23:07 PST 2023  scole@dstar.dstar.net:/home/scole/nbsd/cvs/10_0/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
When running the "file" command I sometimes get an overlow message.   It doesn't seem to affect the result.  It generally happens typically on tgz files for me
>How-To-Repeat:
scole@dstar:~/nbsd/cvs/pkgsrc/distfiles> file Babel-2.13.1.tar.gz 
lhs/off overflow 3584165896 0
Babel-2.13.1.tar.gz: gzip compressed data, was "Babel-2.13.1.tar", last modified: Tue Oct 24 14:33:06 2023, max compression, original size modulo 2^32 34293760
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->christos
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Sat, 06 Jan 2024 15:28:06 +0000
Responsible-Changed-Why:
hi christos, could you have a look?
you can find a file triggering this behaviour at https://src.fedoraproject.org/repo/pkgs/babel/Babel-2.13.1.tar.gz/sha512/c27c76456094927bd43ae46cd3e08fcc729dd810a6092da6c86e863523c10746bb3759e7fc9f5396504ab914743ef013904b63b3aa63338602f23aaf83d42cba/Babel-2.13.1.tar.gz


From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: Christos Zoulas <christos@netbsd.org>,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 "maya@netbsd.org" <maya@NetBSD.org>,
 scole@sdf.org
Subject: Re: bin/57738 (file command getting overflow message)
Date: Sat, 6 Jan 2024 11:36:49 -0500

 [11:35am] 2124>./file  -m ../magic/magic.mgc ~/Babel-2.13.1.tar.gz=20
 /Users/christos/Babel-2.13.1.tar.gz: gzip compressed data, was =
 "Babel-2.13.1.tar", last modified: Tue Oct 24 14:33:06 2023, max =
 compression, original size modulo 2^32 34293760
 [11:35am] 2125>./file -v
 file-5.45
 magic file from /usr/local/share/misc/magic
 [11:36am] 2126>./file -zm ../magic/magic.mgc ~/Babel-2.13.1.tar.gz
 /Users/christos/Babel-2.13.1.tar.gz: POSIX tar archive (gzip compressed =
 data, was "Babel-2.13.1.tar", last modified: Tue Oct 24 14:33:06 2023, =
 max compression)

 > On Jan 6, 2024, at 10:28=E2=80=AFAM, maya@netbsd.org <maya@NetBSD.org> =
 wrote:
 >=20
 > Synopsis: file command getting overflow message
 >=20
 > Responsible-Changed-From-To: bin-bug-people->christos
 > Responsible-Changed-By: maya@NetBSD.org
 > Responsible-Changed-When: Sat, 06 Jan 2024 15:28:06 +0000
 > Responsible-Changed-Why:
 > hi christos, could you have a look?
 > you can find a file triggering this behaviour at =
 https://src.fedoraproject.org/repo/pkgs/babel/Babel-2.13.1.tar.gz/sha512/c=
 27c76456094927bd43ae46cd3e08fcc729dd810a6092da6c86e863523c10746bb3759e7fc9=
 f5396504ab914743ef013904b63b3aa63338602f23aaf83d42cba/Babel-2.13.1.tar.gz
 >=20
 >=20

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/57738 (file command getting overflow message)
Date: Sat, 6 Jan 2024 19:03:54 -0000 (UTC)

 christos@zoulas.com (Christos Zoulas) writes:

 >[11:35am] 2124>./file  -m ../magic/magic.mgc ~/Babel-2.13.1.tar.gz=20
 >/Users/christos/Babel-2.13.1.tar.gz: gzip compressed data, was =
 >"Babel-2.13.1.tar", last modified: Tue Oct 24 14:33:06 2023, max =
 >compression, original size modulo 2^32 3bel-2.13.1.tar.gz 

 % file Babel-2.13.1.tar.gz 
 lhs/off overflow 3584165896 0
 Babel-2.13.1.tar.gz: gzip compressed data, was "Babel-2.13.1.tar", last modified: Tue Oct 24 14:33:06 2023, max compression, original size modulo 2^32 34293760
 4293760

 You need a 32bit machine to see the message when file validates a number
 against INT_MIN/INT_MAX and here that gets triggered by the pattern:

 (0x02.l)        string  *IDENTIFICATION         Becker & Hickl PMS Data File

 The bytes at offset 0x02 in Babel-2.13.1.tar.gz are 08 08 a2 d5, the
 read value is therefore 0xd5a20808 and that overflows a signed integer.


State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 27 Jan 2024 03:17:25 +0000
State-Changed-Why:
closing this as fixed as I could reproduce the problem with file 5.43 on amd64 but can no longer reproduce it on file 5.45 on amd64.
I tested an i386 binary and it didn't fail either -- I suspect the latest reply by mlelstv was testing the older version by mistake. If I'm wrong, let me know, or re-open, or make a new bug (the original report was about amd64)
fixed in current.


From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/57738 (file command getting overflow message)
Date: Sat, 27 Jan 2024 06:44:44 -0000 (UTC)

 maya@NetBSD.org writes:

 >closing this as fixed as I could reproduce the problem with file 5.43 on amd64 but can no longer reproduce it on file 5.45 on amd64.

 netbsd-10 still has file 5.43 and you can reproduce the error.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.