unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 9196@debbugs.gnu.org
Subject: bug#9196: integer and memory overflow issues (e.g., cut-and-paste crashes Emacs)
Date: Sun, 31 Jul 2011 10:57:20 +0200	[thread overview]
Message-ID: <4E3518F0.4040002@swipnet.se> (raw)
In-Reply-To: <4E345892.8010200@cs.ucla.edu>



Paul Eggert skrev 2011-07-30 21:16:
> I take your point that the checks add clutter, so I'll
> revise the patch to address that problem, by adding a
> couple of memory allocators that do the proper overflow
> checking internally, so that callers don't need to
> test for integer overflow.
>
> This will take a bit of time to prepare and test, so
> please bear with me, but to give you a feel here's a draft
> of the revised patch to xgselect.c.  This simplifies
> xgselect.c compared to what's in the trunk now.
>

That is a good approach, very nice.

> --- src/xgselect.c	2011-07-01 09:18:46 +0000
> +++ src/xgselect.c	2011-07-30 18:19:51 +0000
> @@ -54,10 +54,8 @@
>     do {
>       if (n_gfds>  gfds_size)
>         {
> -        while (n_gfds>  gfds_size)
> -          gfds_size *= 2;
>           xfree (gfds);
> -        gfds = xmalloc (sizeof (*gfds) * gfds_size);
> +        gfds = xpmalloc (&gfds_size, n_gfds - gfds_size, INT_MAX, sizeof *gfds);
>         }
>
>       n_gfds = g_main_context_query (context,
>

	Jan D.





  reply	other threads:[~2011-07-31  8:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29  6:44 bug#9196: integer and memory overflow issues (e.g., cut-and-paste crashes Emacs) Paul Eggert
2011-07-29 10:01 ` Jan Djärv
2011-07-29 16:21   ` Paul Eggert
2011-07-29 16:49     ` Jan Djärv
2011-07-29 21:03       ` Paul Eggert
2011-07-30  5:52         ` Jan Djärv
2011-07-30 19:16           ` Paul Eggert
2011-07-31  8:57             ` Jan Djärv [this message]
2011-08-05  2:33               ` Paul Eggert
2011-08-05  9:26                 ` Jan Djärv
2011-08-06  1:24                   ` Paul Eggert
2011-08-08 18:01                     ` Jan Djärv
     [not found] ` <handler.9196.B.131192196724343.ack@debbugs.gnu.org>
2011-08-26 16:38   ` Paul Eggert

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4E3518F0.4040002@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=9196@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).