From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#51105: 29.0.50; Buffer overflow bug in ns_compute_glyph_string_overhangs Date: Sat, 09 Oct 2021 14:43:18 +0300 Message-ID: <83v926whih.fsf@gnu.org> References: <83bl3yya46.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5966"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51105@debbugs.gnu.org To: Daniel =?UTF-8?Q?Mart=C3=ADn?= , Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 09 13:44:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mZAlu-0001ML-Vc for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Oct 2021 13:44:10 +0200 Original-Received: from localhost ([::1]:53724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZAlt-0003VR-2g for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Oct 2021 07:44:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZAlm-0003V0-8E for bug-gnu-emacs@gnu.org; Sat, 09 Oct 2021 07:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZAll-0000VJ-Vt for bug-gnu-emacs@gnu.org; Sat, 09 Oct 2021 07:44:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mZAll-0004fD-SV for bug-gnu-emacs@gnu.org; Sat, 09 Oct 2021 07:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Oct 2021 11:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51105 X-GNU-PR-Package: emacs Original-Received: via spool by 51105-submit@debbugs.gnu.org id=B51105.163377983217906 (code B ref 51105); Sat, 09 Oct 2021 11:44:01 +0000 Original-Received: (at 51105) by debbugs.gnu.org; 9 Oct 2021 11:43:52 +0000 Original-Received: from localhost ([127.0.0.1]:52408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZAlc-0004ek-Ac for submit@debbugs.gnu.org; Sat, 09 Oct 2021 07:43:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZAlY-0004eR-4q for 51105@debbugs.gnu.org; Sat, 09 Oct 2021 07:43:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52452) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZAlN-0000Ri-9C; Sat, 09 Oct 2021 07:43:39 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1358 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZAlM-0006Nz-Sv; Sat, 09 Oct 2021 07:43:37 -0400 In-Reply-To: (message from Daniel =?UTF-8?Q?Mart=C3=ADn?= on Sat, 09 Oct 2021 12:06:36 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:216766 Archived-At: > From: Daniel Martín > Cc: 51105@debbugs.gnu.org > Date: Sat, 09 Oct 2021 12:06:36 +0200 > > Now I think that the right thing to do may be to modify nsterm.m, switch > on the glyph type and, if the glyph type is COMPOSITE_GLYPH, call > composition_gstring_width to get the glyph metrics. Function > composition_gstring_width uses the values from fields s->cmp_from and > s->cmp_to, and would avoid the buffer overflow: > > (lldb) fr v s->cmp_from > (int) s->cmp_from = 6 > (lldb) fr v s->cmp_to > (int) s->cmp_to = 7 > > WDYT? I can prepare a patch of this type if you agree. SGTM, but I'd like to hear Alan's opinion as well, as I don't feel I know enough about the NS display backend.