diff options
| author | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-01-12 11:26:13 +0100 | 
|---|---|---|
| committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-01-14 10:19:21 +0100 | 
| commit | 12f606a2a8e8a61c9f54ce87ed680914eaa503fe (patch) | |
| tree | c1cee477a1146c676a079f496ddc3264614d25df /src | |
| parent | 9b4f6fbd33ebd452d472b0333accfcb34e01173b (diff) | |
| download | rneovim-12f606a2a8e8a61c9f54ce87ed680914eaa503fe.tar.gz rneovim-12f606a2a8e8a61c9f54ce87ed680914eaa503fe.tar.bz2 rneovim-12f606a2a8e8a61c9f54ce87ed680914eaa503fe.zip  | |
Fix bad assert.
Problem  : Assert can fail for legal values. Modulo-arithmetic of
           unsigned types can make so that n * 100 > n, but n has
           overflowed.
Solution : Use alternative form of expression.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/hardcopy.c | 4 | 
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 993ec143bb..92abcbada4 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -14,6 +14,7 @@  #include <errno.h>  #include <string.h>  #include <inttypes.h> +#include <stdint.h>  #include "nvim/vim.h"  #include "nvim/ascii.h" @@ -726,8 +727,7 @@ void ex_hardcopy(exarg_T *eap)            if (got_int || settings.user_abort)              goto print_fail; -          assert(prtpos.bytes_printed == 0 -                 || prtpos.bytes_printed * 100 > prtpos.bytes_printed); +          assert(prtpos.bytes_printed <= SIZE_MAX / 100);            sprintf((char *)IObuff, _("Printing page %d (%zu%%)"),                    page_count + 1 + side,                    prtpos.bytes_printed * 100 / bytes_to_print);  | 
