[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netbsd-bugs
Subject:    bin/26453: diff "out of memory" trying to allocate 0 with malloc option "V"
From:       raeburn () raeburn ! org
Date:       2004-07-27 19:28:50
Message-ID: 20040727192850.06D941115C () narn ! netbsd ! org
[Download RAW message or body]


> 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:          open
> Class:          sw-bug
> Submitter-Id:   net
> Arrival-Date:   Tue Jul 27 21:54:00 UTC 2004
> Closed-Date:
> Last-Modified:
> 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
30c04231cb3de404e4b8a5359a74066fd963291d7986be835834ab07870c097682a953bfff38784780eef8 \
44de47fb36c34f8e034c96cfa64d9cb5decee472138236e9fb79e9fe1fba6b7757b970f22477d167832206 \
900473f09f3e8c822db6d9a8273340ed6743d99638d6cf192d821b6f33d23278b1a929f303a80865c426d0 \
1add11b2f2416babd13e70b44d8eeb731c09c7163af9d1a23cbe20ddb08b0f67ecaa2eed511263a67e9c12 \
e59ef113f0b9e4e4e140b43896078a7571c61826ba099b3dd8c4b096a9785b4434e97ea99e662ba6fdb60a \
41547ccae4c67d3e1f3ef515198e91f009c75c9e80fda90d13ee29d8aad5d87cc2437ce60e6ce55700837f \
b0815bfd2495f8aa1a33fe67c1ae28a885506a78ca6257f5a5f2a8042e28680acc83b1aecb3a9cb5191112 \
6f2f0deaf14fcfa5f165e9a5c3f8f2d1c3f4683b2d75927a7bc802d63b680a5e22768cc0439854ccd49e58 \
a002794f541bddd6ef6fbd4f9869843a72d0ae9d438c90353a46c0c9863a16b1de206c717ab7ce6ea6f648 \
a38efa12b70bbe3388b35adec7a789ea98de217520d7d6ce699841e17e5946bf5a8b3c7a2c3e2d6767422b \
af3159ff08d913ec78011ab7d34bc24af26c24a8d46f7261c7705a7b270e27590c29583c659a0df8dada4e7a0532f115040165d18f74a55a4f39bb1dcfd865e94a
  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:
> Unformatted:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic