NetBSD Problem Report #26453

Received: (qmail 17700 invoked by uid 605); 27 Jul 2004 21:52:59 -0000
Message-Id: <20040727192850.06D941115C@narn.netbsd.org>
Date: Tue, 27 Jul 2004 19:28:50 +0000 (UTC)
From: raeburn@raeburn.org
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: raeburn@raeburn.org
To: gnats-bugs@gnats.NetBSD.org
Subject: diff "out of memory" trying to allocate 0 with malloc option "V"
X-Send-Pr-Version: www-1.0

>Number:         26453
>Category:       bin
>Synopsis:       diff "out of memory" trying to allocate 0 with malloc option "V"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 27 21:54:00 +0000 2004
>Closed-Date:    Tue Mar 13 05:40:49 +0000 2012
>Last-Modified:  Tue Mar 13 05:40:49 +0000 2012
>Originator:     Ken Raeburn
>Release:        2.0 branch approx 7/27/2004
>Organization:
MIT
>Environment:
NetBSD venix.mit.edu 2.0_BETA NetBSD 2.0_BETA (GENERIC) #0: Sun Jul 18 00:45:57 EDT 2004  root@venix.mit.edu:/u1/obj/sys/arch/alpha/compile/GENERIC alpha

>Description:
When I run diff on two copies of t_prng.expected from the MIT Kerberos distribution, diff claims that it's run out of memory.  In fact, it's calling malloc(0), and the NULL return value (MALLOC_OPTIONS is "AJRVX<<") is causing confusion.

The test jm_FUNC_MALLOC -- ignore the description of determining whether malloc "works" -- checks for malloc(0) returning non-null values, and a "replacement" is used if it does.

>How-To-Repeat:
env MALLOC_OPTIONS=V diff /tmp/a /tmp/b
where a and b are both the four-line file:
18086b1e91f730facb2d6e1b
c562653b24814eb3651b1e68301a3c14b96302bb
6d017f7aef74662ed8dd51eef14281eaad223298db370bfaca
30c04231cb3de404e4b8a5359a74066fd963291d7986be835834ab07870c097682a953bfff38784780eef844de47fb36c34f8e034c96cfa64d9cb5decee472138236e9fb79e9fe1fba6b7757b970f22477d167832206900473f09f3e8c822db6d9a8273340ed6743d99638d6cf192d821b6f33d23278b1a929f303a80865c426d01add11b2f2416babd13e70b44d8eeb731c09c7163af9d1a23cbe20ddb08b0f67ecaa2eed511263a67e9c12e59ef113f0b9e4e4e140b43896078a7571c61826ba099b3dd8c4b096a9785b4434e97ea99e662ba6fdb60a41547ccae4c67d3e1f3ef515198e91f009c75c9e80fda90d13ee29d8aad5d87cc2437ce60e6ce55700837fb0815bfd2495f8aa1a33fe67c1ae28a885506a78ca6257f5a5f2a8042e28680acc83b1aecb3a9cb51911126f2f0deaf14fcfa5f165e9a5c3f8f2d1c3f4683b2d75927a7bc802d63b680a5e22768cc0439854ccd49e58a002794f541bddd6ef6fbd4f9869843a72d0ae9d438c90353a46c0c9863a16b1de206c717ab7ce6ea6f648a38efa12b70bbe3388b35adec7a789ea98de217520d7d6ce699841e17e5946bf5a8b3c7a2c3e2d6767422baf3159ff08d913ec78011ab7d34bc24af26c24a8d46f7261c7705a7b270e27590c29583c659a0df8dada4e7a0532f115040165d18f74a55a4f39bb1dcfd865e94a
 488ca910cc447e121b2a19450239e75d24

(I hope that copy of the file comes through okay.)
>Fix:
Use the replacement function always.

Set MALLOC_OPTIONS to include "V" when running configure scripts to come up with config.h files to check in (assuming that's how they're produced).
>Release-Note:
>Audit-Trail:
From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/26453 CVS commit: src
Date: Tue, 3 May 2011 15:13:51 +0000

 Module Name:	src
 Committed By:	jruoho
 Date:		Tue May  3 15:13:51 UTC 2011

 Modified Files:
 	src/distrib/sets/lists/tests: mi
 	src/etc/mtree: NetBSD.dist.tests
 	src/tests/usr.bin: Makefile
 Added Files:
 	src/tests/usr.bin/diff: Makefile d_mallocv1.in d_mallocv2.in t_diff.sh

 Log Message:
 Add a test case for PR bin/26453.


 To generate a diff of this commit:
 cvs rdiff -u -r1.325 -r1.326 src/distrib/sets/lists/tests/mi
 cvs rdiff -u -r1.45 -r1.46 src/etc/mtree/NetBSD.dist.tests
 cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/Makefile
 cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/diff/Makefile \
     src/tests/usr.bin/diff/d_mallocv1.in src/tests/usr.bin/diff/d_mallocv2.in \
     src/tests/usr.bin/diff/t_diff.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/26453 CVS commit: src/gnu/dist/diffutils/lib
Date: Mon, 12 Mar 2012 13:41:59 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Mar 12 17:41:59 UTC 2012

 Modified Files:
 	src/gnu/dist/diffutils/lib: xmalloc.c

 Log Message:
 PR/26453: Ken Raeburn: make zero byte allocations return NULL instead of error
 out.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.1 -r1.2 src/gnu/dist/diffutils/lib/xmalloc.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: jruoho@NetBSD.org
State-Changed-When: Tue, 13 Mar 2012 05:40:49 +0000
State-Changed-Why:

Fixed and fix confirmed by the test runs.



>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.