From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: Uniform vector lengths -- how long? Date: Mon, 12 Jul 2004 10:04:05 -0500 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87isctl122.fsf@trouble.defaultvalue.org> References: <878yeieyhp.fsf@trouble.defaultvalue.org> <87vfhlstec.fsf@zip.com.au> <87wu21cvyz.fsf@trouble.defaultvalue.org> <87zn68ithm.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1089644730 15257 80.91.224.253 (12 Jul 2004 15:05:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 12 Jul 2004 15:05:30 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jul 12 17:05:19 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bk2Mp-00077t-00 for ; Mon, 12 Jul 2004 17:05:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bk2P6-0001Ug-I5 for guile-devel@m.gmane.org; Mon, 12 Jul 2004 11:07:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Bk2Oz-0001UE-RC for guile-devel@gnu.org; Mon, 12 Jul 2004 11:07:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Bk2Oy-0001Tg-CE for guile-devel@gnu.org; Mon, 12 Jul 2004 11:07:32 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bk2Oy-0001TB-8y for guile-devel@gnu.org; Mon, 12 Jul 2004 11:07:32 -0400 Original-Received: from [66.93.216.237] (helo=defaultvalue.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Bk2MF-0005Ni-MB for guile-devel@gnu.org; Mon, 12 Jul 2004 11:04:44 -0400 Original-Received: from trouble.defaultvalue.org (omen.defaultvalue.org [192.168.1.1]) by defaultvalue.org (Postfix) with ESMTP id B7A8B40BC for ; Mon, 12 Jul 2004 10:04:41 -0500 (CDT) Original-Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id 0D68E410AC; Mon, 12 Jul 2004 10:04:05 -0500 (CDT) Original-To: guile-devel@gnu.org In-Reply-To: <87zn68ithm.fsf@zip.com.au> (Kevin Ryde's message of "Sat, 10 Jul 2004 10:41:25 +1000") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3862 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3862 Kevin Ryde writes: > I suppose, though personally I wouldn't feel any great urgency for > that. A positive inum ends up only, what, 3 bits less than a ulong, > and a 512Mb array would be more than likely bigger than one could do > real work with on a 32-bit machine. > > What is worth worrying about though would be making sure the "len * > uvec_sizes[type]" in make_uvec doesn't overflow, perhaps wrapping > around to a small size which is successfully malloced. I guess > currently with a maximum 8 in uvec_sizes and maximum > MOST_POSITIVE_INUM for the count it's ok. OK, I've fixed both of these. After talking to Marius, I reworked srfi-4 to use size_t for the length, since (as he pointed out) that's what you'll eventually pass to malloc, and we will just make the assertion that size_t must fit in a cell. I also added checking to make_uvec to avoid the possibility of overflow with types bigger than 1 byte. Although the current solution depends on SIZE_MAX being defined, and we wondered if it's sufficiently common. if (len > ((size_t) SIZE_MAX / uvec_sizes[type])) ... (I'll commit after I have a chance to double check the work.) Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel