From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#8435: misuse of error ("...%d...", ...) on 64-bit hosts Date: Thu, 07 Apr 2011 13:43:39 -0700 Organization: UCLA Computer Science Department Message-ID: <4D9E21FB.70802@cs.ucla.edu> References: <4D9CC60D.2090301@cs.ucla.edu> <4D9D68D8.6060200@cs.ucla.edu> <8339ltvrok.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1302210454 30819 80.91.229.12 (7 Apr 2011 21:07:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 7 Apr 2011 21:07:34 +0000 (UTC) Cc: 8435@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 07 23:07:30 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Q7wQI-0001jC-VG for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Apr 2011 23:07:27 +0200 Original-Received: from localhost ([127.0.0.1]:37556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7wQI-0004ME-2y for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Apr 2011 17:07:26 -0400 Original-Received: from [140.186.70.92] (port=58138 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7wQB-0004M4-Cx for bug-gnu-emacs@gnu.org; Thu, 07 Apr 2011 17:07:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7wQA-0003pS-AF for bug-gnu-emacs@gnu.org; Thu, 07 Apr 2011 17:07:19 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7wQA-0003pN-8h for bug-gnu-emacs@gnu.org; Thu, 07 Apr 2011 17:07:18 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Q7w3d-0000i6-ON; Thu, 07 Apr 2011 16:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Apr 2011 20:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8435 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8435-submit@debbugs.gnu.org id=B8435.13022090282704 (code B ref 8435); Thu, 07 Apr 2011 20:44:01 +0000 Original-Received: (at 8435) by debbugs.gnu.org; 7 Apr 2011 20:43:48 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7w3P-0000hZ-Qz for submit@debbugs.gnu.org; Thu, 07 Apr 2011 16:43:48 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7w3N-0000hM-IJ for 8435@debbugs.gnu.org; Thu, 07 Apr 2011 16:43:46 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id C468039E80E0; Thu, 7 Apr 2011 13:43:39 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 82XyzL117gYV; Thu, 7 Apr 2011 13:43:39 -0700 (PDT) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 4051F39E8083; Thu, 7 Apr 2011 13:43:39 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 In-Reply-To: <8339ltvrok.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 07 Apr 2011 16:44:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:45682 Archived-At: On 04/07/2011 11:31 AM, Eli Zaretskii wrote: > `doprnt' was careful in these cases, e.g., it would take care of truncating > multibyte strings only on character boundaries. Thanks for the review. This problem should be OK, as the only place where truncation can occur is in the call from vmessage to doprnt, and the patched arranges for vmessage to do that truncation. > It also supported %c format for converting a multibyte character to > its integer representation. This problem should be OK too. I manually inspected all the places that used the %c format. All but one of them used %c only to convert unibyte characters, so they're OK. The only exception was in charset_iso_charset_parameter, and I modified that function to convert the multibyte character before passing it as a string to 'error'. > There's also an issue with old pre-C99 implementations of `vsnprintf' > which returned -1 when the buffer was too small. However, I think > catering for those would be a trivial change in `verror', so that's > not a big deal. Yes, thanks, I'll look into this. Another issue has come up in further static analysis. The vsnprintf API does not work for strings longer than INT_MAX bytes. For vmessage's use of vsnprintf this is OK, since (for other reasons) a frame title can't be that long. However, for verror this is an arbitrary limitation on typical 64-bit hosts. I'll look into this, and plan to propose a further patch to handle it. Gnulib already handles this situation, with its vasnprintf module, and most likely I'll end up using that, or a variant of that. This will most likely affect the Windows port too.