bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9196: integer and memory overflow issues (e.g., cut-and-paste crashe


From: Jan Djärv
Subject: bug#9196: integer and memory overflow issues (e.g., cut-and-paste crashes Emacs)
Date: Sun, 31 Jul 2011 10:57:20 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:5.0) Gecko/20110624 Thunderbird/5.0



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 via email to

[Prev in Thread] Current Thread [Next in Thread]