Mercurial > vim
comparison src/drawscreen.c @ 29704:5b3a88601317 v9.0.0192
patch 9.0.0192: possible invalid memory access when 'cmdheight' is zero
Commit: https://github.com/vim/vim/commit/fdc5d17d58cc9c9edc9fb2816e1afaabc531bf1e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 11 15:52:14 2022 +0100
patch 9.0.0192: possible invalid memory access when 'cmdheight' is zero
Problem: Possible invalid memory access when 'cmdheight' is zero. (Martin
Tournoij)
Solution: Avoid going over the end of w_lines[] when w_height is Rows.
(closes #10882)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 11 Aug 2022 17:00:03 +0200 |
parents | 8a243ecfe2dd |
children | 89e1d67814a9 |
comparison
equal
deleted
inserted
replaced
29703:0e09dde486f6 | 29704:5b3a88601317 |
---|---|
1806 top_end = i; | 1806 top_end = i; |
1807 scrolled_down = TRUE; | 1807 scrolled_down = TRUE; |
1808 | 1808 |
1809 // Move the entries that were scrolled, disable | 1809 // Move the entries that were scrolled, disable |
1810 // the entries for the lines to be redrawn. | 1810 // the entries for the lines to be redrawn. |
1811 // Avoid using a wrong index when 'cmdheight' is | |
1812 // zero and wp->w_height == Rows. | |
1811 if ((wp->w_lines_valid += j) > wp->w_height) | 1813 if ((wp->w_lines_valid += j) > wp->w_height) |
1812 wp->w_lines_valid = wp->w_height; | 1814 wp->w_lines_valid = wp->w_height; |
1813 for (idx = wp->w_lines_valid; idx - j >= 0; idx--) | 1815 for (idx = wp->w_lines_valid >= wp->w_height |
1816 ? wp->w_height - 1 : wp->w_lines_valid; | |
1817 idx - j >= 0; idx--) | |
1814 wp->w_lines[idx] = wp->w_lines[idx - j]; | 1818 wp->w_lines[idx] = wp->w_lines[idx - j]; |
1815 while (idx >= 0) | 1819 while (idx >= 0) |
1816 wp->w_lines[idx--].wl_valid = FALSE; | 1820 wp->w_lines[idx--].wl_valid = FALSE; |
1817 } | 1821 } |
1818 } | 1822 } |