From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: oops? read/write vs type of length parameter Date: Mon, 11 Apr 2011 14:31:45 +0200 Organization: Organization?!? Message-ID: <877hb1m0jy.fsf@fencepost.gnu.org> References: <87wrj1jhfc.fsf@rho.meyering.net> <87d3ktjb9l.fsf@rho.meyering.net> <877hb1j7lz.fsf@rho.meyering.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1302525139 13611 80.91.229.12 (11 Apr 2011 12:32:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 11 Apr 2011 12:32:19 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 11 14:32:15 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q9GHu-0001zx-8g for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 14:32:14 +0200 Original-Received: from localhost ([127.0.0.1]:48142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9GHp-0001tZ-Tu for ged-emacs-devel@m.gmane.org; Mon, 11 Apr 2011 08:32:09 -0400 Original-Received: from [140.186.70.92] (port=56344 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q9GHl-0001rz-DD for emacs-devel@gnu.org; Mon, 11 Apr 2011 08:32:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9GHi-0003Sh-7L for emacs-devel@gnu.org; Mon, 11 Apr 2011 08:32:04 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:55631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9GHi-0003Sa-18 for emacs-devel@gnu.org; Mon, 11 Apr 2011 08:32:02 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q9GHe-0001r1-HB for emacs-devel@gnu.org; Mon, 11 Apr 2011 14:31:58 +0200 Original-Received: from p508ecc97.dip.t-dialin.net ([80.142.204.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Apr 2011 14:31:58 +0200 Original-Received: from dak by p508ecc97.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Apr 2011 14:31:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 15 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: p508ecc97.dip.t-dialin.net X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:y9NEYtmG5s7+uNxzr+X/gy7ppWU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138388 Archived-At: Jim Meyering writes: > What about when EMACS_INT is defined to "int"? > > Someone will inevitably call your write-like function > with a length of type size_t -- many existing uses do just that -- > and by using a signed type, you will have converted their long > yet valid (2-4GiB), buffer length, into a negative number. Resulting in an error or nothing happening. In contrast, if a negative number is turned into a long yet valid (2-4GiB) number, it is very likely that unintended memory areas will get stomped over. -- David Kastrup