]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/character.c (lisp_string_width): Add missing type checks.
authorPhilipp Stephani <phst@google.com>
Thu, 27 May 2021 10:44:09 +0000 (12:44 +0200)
committerPhilipp Stephani <phst@google.com>
Thu, 27 May 2021 10:44:09 +0000 (12:44 +0200)
src/character.c

index 5753e883c320ac19dac56503ac46d324c715f34b..b16c9fd6b8bf300361eb5cfbeebf53c064c5e1b3 100644 (file)
@@ -394,10 +394,14 @@ lisp_string_width (Lisp_Object string, ptrdiff_t from, ptrdiff_t to,
                                 SBYTES (default_font))))
                {
                  Lisp_Object font_info = Ffont_info (default_font, Qnil);
-                 font_width = AREF (font_info, 11);
-                 if (font_info <= 0)
-                   font_width = AREF (font_info, 10);
-               }
+                  font_width
+                    = check_integer_range (AREF (font_info, 11),
+                                           INT_MIN, INT_MAX);
+                  if (font_width <= 0)
+                    font_width
+                      = check_integer_range (AREF (font_info, 10),
+                                             INT_MIN, INT_MAX);
+                }
            }
          thiswidth = (double) pixelwidth / font_width + 0.5;
          chars = end - i;