2011-07-29 Paul Eggert <eggert@cs.ucla.edu>
+ * xsmfns.c (smc_save_yourself_CB): Check for size calc overflow.
+
* xselect.c: Integer and memory overflow issues.
(X_LONG_SIZE, X_USHRT_MAX, X_ULONG_MAX): New macros.
Use them to make the following changes clearer.
props[props_idx]->name = xstrdup (SmRestartCommand);
props[props_idx]->type = xstrdup (SmLISTofARRAY8);
/* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */
+ if (min (INT_MAX, min (PTRDIFF_MAX, SIZE_MAX) / sizeof *vp) - 3
+ < initial_argc)
+ memory_full (SIZE_MAX);
i = 3 + initial_argc;
props[props_idx]->num_vals = i;
vp = (SmPropValue *) xmalloc (i * sizeof(*vp));