emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 501296f: * src/character.c (lisp_string_width): Add missing type


From: Philipp Stephani
Subject: master 501296f: * src/character.c (lisp_string_width): Add missing type checks.
Date: Thu, 27 May 2021 06:46:06 -0400 (EDT)

branch: master
commit 501296f994ba8b578d8a546eddfd2cdc365305f3
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>

    * src/character.c (lisp_string_width): Add missing type checks.
---
 src/character.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/character.c b/src/character.c
index 5753e88..b16c9fd 100644
--- a/src/character.c
+++ b/src/character.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]