diff options
author | =?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com> | 2022-01-29 15:19:23 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-29 15:19:23 +0000 |
commit | d5cec1f1f055316c353cfa15ad8d5eb0952d50a0 (patch) | |
tree | 94d3ad44783e3442be7293edb3d5890ac08f0377 /src/hardcopy.c | |
parent | f12b7815f6b55c3e2f37366aa45e723b1fcb2e9a (diff) |
patch 8.2.4255: theoretical computation overflowv8.2.4255
Problem: Theoretical computation overflow.
Solution: Perform multiplication in a wider type. (closes #9657)
Diffstat (limited to 'src/hardcopy.c')
-rw-r--r-- | src/hardcopy.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/hardcopy.c b/src/hardcopy.c index c99dc5fa35..a41f330317 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -2769,9 +2769,9 @@ mch_print_begin(prt_settings_T *psettings) // derive the bbox from that point. We have the expected cpl chars // across the media and lpp lines down the media. bbox[1] = (int)(top - (psettings->lines_per_page + prt_header_height()) - * prt_line_height); - bbox[2] = (int)(left + psettings->chars_per_line * prt_char_width - + 0.5); + * (double)prt_line_height); + bbox[2] = (int)(left + psettings->chars_per_line + * (double)prt_char_width + 0.5); bbox[3] = (int)(top + 0.5); } else @@ -2782,8 +2782,8 @@ mch_print_begin(prt_settings_T *psettings) bbox[1] = (int)bottom; bbox[2] = (int)(left + ((psettings->lines_per_page + prt_header_height()) * prt_line_height) + 0.5); - bbox[3] = (int)(bottom + psettings->chars_per_line * prt_char_width - + 0.5); + bbox[3] = (int)(bottom + psettings->chars_per_line + * (double)prt_char_width + 0.5); } prt_dsc_ints("BoundingBox", 4, bbox); // The media width and height does not change with landscape printing! @@ -2797,7 +2797,7 @@ mch_print_begin(prt_settings_T *psettings) if (prt_out_mbyte) { prt_dsc_font_resource((prt_use_courier ? NULL - : "DocumentNeededResources"), &prt_ps_mb_font); + : "DocumentNeededResources"), &prt_ps_mb_font); if (!prt_custom_cmap) prt_dsc_resources(NULL, "cmap", prt_cmap); } |