all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 8435@debbugs.gnu.org
Subject: bug#8435: misuse of error ("...%d...", ...) on 64-bit hosts
Date: Thu, 07 Apr 2011 13:43:39 -0700	[thread overview]
Message-ID: <4D9E21FB.70802@cs.ucla.edu> (raw)
In-Reply-To: <8339ltvrok.fsf@gnu.org>

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.






  reply	other threads:[~2011-04-07 20:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 19:59 bug#8435: misuse of error ("...%d...", ...) on 64-bit hosts Paul Eggert
     [not found] ` <handler.8435.B.130211997010029.ack@debbugs.gnu.org>
2011-04-07  7:33   ` Paul Eggert
2011-04-07 12:29     ` Andy Moreton
2011-04-07 18:31     ` Eli Zaretskii
2011-04-07 20:43       ` Paul Eggert [this message]
2011-04-08  8:58         ` Eli Zaretskii
2011-04-08 23:34           ` Paul Eggert
2011-04-09  7:20             ` Eli Zaretskii
2011-04-09 18:24               ` Paul Eggert
2011-04-09 18:32                 ` Eli Zaretskii
2011-04-09 19:39                   ` Paul Eggert
2011-04-09 20:21                     ` Eli Zaretskii
2011-04-10  3:52                       ` Stefan Monnier
2011-04-10  5:19                         ` Eli Zaretskii
2011-04-11  1:44                           ` Stefan Monnier
2011-04-11  2:54                             ` Eli Zaretskii
2011-04-10 17:03                       ` Paul Eggert
2011-04-09 19:28                 ` Eli Zaretskii
2011-04-09 19:43                   ` Paul Eggert
2011-04-08 23:37           ` Paul Eggert
2011-04-25  0:59             ` Daniel Colascione
2011-04-25  6:42               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D9E21FB.70802@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=8435@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.