]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0039: potential integer underflow in screen_line() v9.2.0039
authorChristian Brabandt <cb@256bit.org>
Sat, 21 Feb 2026 10:50:20 +0000 (10:50 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 21 Feb 2026 10:53:25 +0000 (10:53 +0000)
Problem:  In screen_line(), there is a potential integer underflow when
          accessing ScreenAttrs[off_to - 1] if off_to is zero.
          (Coverity CID 1681430, after v9.2.0017)
Solution: Add a check to ensure off_to > 0 before accessing the
          previous attribute index.

related: #19272
closes:  #19479

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/screen.c
src/version.c

index 6e6f11b70b6399b51be0ab4db3bec5e1b7e0bc59..b3fe3705e03462702eaf2fb001afea6cba98f51c 100644 (file)
@@ -848,7 +848,7 @@ skip_opacity:
 #ifdef FEAT_GUI
                && !gui.in_use
 #endif
-               && col + coloff > 0)
+               && col + coloff > 0 && off_to > 0)
        {
            if (ScreenAttrs[off_to] == ScreenAttrs[off_to - 1])
            {
index 871f3b23926524c6cf03915e7d9c2f0e149aaec4..336ac8894fb6daca4235a50c7b196e9a87c127e4 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    39,
 /**/
     38,
 /**/