[Top][All Lists]

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

Strange code in emacs.c

From: Eli Zaretskii
Subject: Strange code in emacs.c
Date: Wed, 03 Oct 2018 18:15:11 +0300

We have this in 'main':

      emacs_re_safe_alloca = max
        (min (lim - extra, SIZE_MAX) * (min_ratio / ratio),

This always yields MAX_ALLOCA because 'ratio' is always greater than

      int min_ratio = 20 * sizeof (char *);
      int ratio = min_ratio + min_ratio / 3;

Don't we mean to set emacs_re_safe_alloca like this instead:

      emacs_re_safe_alloca = min (lim - extra, SIZE_MAX) / ratio;
      emacs_re_safe_alloca = max (emacs_re_safe_alloca * min_ratio, MAX_ALLOCA);

reply via email to

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