GNU bug report logs - #72104
[PATCH] xwidget: Fix xwidget-at misinterpreting non-xwidget text-properties

Previous Next

Package: emacs;

Reported by: George Huebner <george <at> feyor.sh>

Date: Sun, 14 Jul 2024 07:20:01 UTC

Severity: normal

Tags: patch

Merged with 72848

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72104 in the body.
You can then email your comments to 72104 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#72104; Package emacs. (Sun, 14 Jul 2024 07:20:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to George Huebner <george <at> feyor.sh>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 14 Jul 2024 07:20:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: George Huebner <george <at> feyor.sh>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] xwidget: Fix xwidget-at misinterpreting non-xwidget
 text-properties
Date: Sun, 14 Jul 2024 02:19:23 -0500
[Message part 1 (text/plain, inline)]
Tags: patch

xwidget-at assumes the text-property at `point-min` either doesn't 
exist or is an xwidget, and can improperly access fields. This 
patch just returns nil if the text-property isn't an xwidget.

This is definitely an edge case; I use a package called org-modern 
where headlines are formatted with text-properties, which is how I 
found the bug:
Debugger entered--Lisp error: (wrong-type-argument listp #("◉" 0 1 
(face org-modern-symbol)))
 xwidget-at(1)
 xwidget-webkit-current-session()


In GNU Emacs 29.1 (build 1, aarch64-apple-darwin23.4.0, Carbon 
Version
170 AppKit 2487.5)
Windowing system distributor 'Apple Inc.', version 14.4.0
System Description:  macOS 14.4

Configured using:
'configure
--prefix=/nix/store/ismv7jzf3hcqziq5bpjfs54zd4qfjjn7-emacs-mac-macport-29.1
--disable-build-details --with-modules --without-gif 
--without-jpeg
--without-png --without-tiff --without-x --without-xpm
'--enable-mac-app=$$out/Applications' --with-gnutls --with-mac
--with-xml2 --without-ns --with-compress-install
--with-toolkit-scroll-bars --with-native-compilation
--without-imagemagick --with-mailutils --without-small-ja-dic
--with-tree-sitter --without-xinput2 --without-xwidgets 
--without-dbus
--without-selinux --with-xwidgets'
[0001-xwidget-Fix-xwidget-at-misinterpreting-non-xwidget-t.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72104; Package emacs. (Sun, 23 Feb 2025 00:53:01 GMT) Full text and rfc822 format available.

Message #8 received at 72104 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: George Huebner <george <at> feyor.sh>
Cc: Po Lu <luangruo <at> yahoo.com>, 72104 <at> debbugs.gnu.org
Subject: Re: bug#72104: [PATCH] xwidget: Fix xwidget-at misinterpreting
 non-xwidget text-properties
Date: Sun, 23 Feb 2025 00:51:58 +0000
George Huebner <george <at> feyor.sh> writes:

> xwidget-at assumes the text-property at `point-min` either doesn't exist or is
> an xwidget, and can improperly access fields. This patch just returns nil if the
> text-property isn't an xwidget.
>
> This is definitely an edge case; I use a package called org-modern where
> headlines are formatted with text-properties, which is how I found the bug:
> Debugger entered--Lisp error: (wrong-type-argument listp #("◉" 0 1 (face
> org-modern-symbol)))
>  xwidget-at(1)
>  xwidget-webkit-current-session()

Po Lu, any comments on this patch?

>>From 48a662563bc6e7c5bc63dc63da4e0c36909b6cc2 Mon Sep 17 00:00:00 2001
> From: George Huebner <george <at> feyor.sh>
> Date: Sun, 14 Jul 2024 01:46:07 -0500
> Subject: [PATCH] xwidget: Fix xwidget-at misinterpreting non-xwidget
>  text-properties
>
> xwidget-open wrongly assumes the the text-property at min-position is an
> xwidget, if it exists; the fix is just returning nil if the
> text-property isn't an xwidget.
> ---
>  lisp/xwidget.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/xwidget.el b/lisp/xwidget.el
> index bf5987d..c5a84db 100644
> --- a/lisp/xwidget.el
> +++ b/lisp/xwidget.el
> @@ -81,7 +81,7 @@ This returns the result of `make-xwidget'."
>  (defun xwidget-at (pos)
>    "Return xwidget at POS."
>    (let* ((disp (get-text-property pos 'display))
> -         (xw (car (cdr (cdr disp)))))
> +         (xw (ignore-errors (car (cdr (cdr disp))))))
>      (when (xwidget-live-p xw) xw)))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72104; Package emacs. (Mon, 24 Feb 2025 20:25:01 GMT) Full text and rfc822 format available.

Message #11 received at 72104 <at> debbugs.gnu.org (full text, mbox):

From: George Huebner <george <at> feyor.sh>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Po Lu <luangruo <at> yahoo.com>, 72104 <at> debbugs.gnu.org
Subject: Re: bug#72104: [PATCH] xwidget: Fix xwidget-at misinterpreting
 non-xwidget text-properties
Date: Mon, 24 Feb 2025 14:23:52 -0600
This patch was already accepted in 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72848.
Thank you for following up though!

On Sat, Feb 22, 2025 at 18:51:58 EST Stefan Kangas wrote:

> George Huebner <george <at> feyor.sh> writes:
>
>> xwidget-at assumes the text-property at `point-min` either 
>> doesn't exist or is
>> an xwidget, and can improperly access fields. This patch just 
>> returns nil if the
>> text-property isn't an xwidget.
>>
>> This is definitely an edge case; I use a package called 
>> org-modern where
>> headlines are formatted with text-properties, which is how I 
>> found the bug:
>> Debugger entered--Lisp error: (wrong-type-argument listp #("◉" 
>> 0 1 (face
>> org-modern-symbol)))
>>  xwidget-at(1)
>>  xwidget-webkit-current-session()
>
> Po Lu, any comments on this patch?
>
>>>From 48a662563bc6e7c5bc63dc63da4e0c36909b6cc2 Mon Sep 17 
>>>00:00:00 2001
>> From: George Huebner <george <at> feyor.sh>
>> Date: Sun, 14 Jul 2024 01:46:07 -0500
>> Subject: [PATCH] xwidget: Fix xwidget-at misinterpreting 
>> non-xwidget
>>  text-properties
>>
>> xwidget-open wrongly assumes the the text-property at 
>> min-position is an
>> xwidget, if it exists; the fix is just returning nil if the
>> text-property isn't an xwidget.
>> ---
>>  lisp/xwidget.el | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lisp/xwidget.el b/lisp/xwidget.el
>> index bf5987d..c5a84db 100644
>> --- a/lisp/xwidget.el
>> +++ b/lisp/xwidget.el
>> @@ -81,7 +81,7 @@ This returns the result of `make-xwidget'."
>>  (defun xwidget-at (pos)
>>    "Return xwidget at POS."
>>    (let* ((disp (get-text-property pos 'display))
>> -         (xw (car (cdr (cdr disp)))))
>> +         (xw (ignore-errors (car (cdr (cdr disp))))))
>>      (when (xwidget-live-p xw) xw)))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72104; Package emacs. (Mon, 24 Feb 2025 21:21:02 GMT) Full text and rfc822 format available.

Message #14 received at 72104 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: George Huebner <george <at> feyor.sh>
Cc: Po Lu <luangruo <at> yahoo.com>, 72104 <at> debbugs.gnu.org
Subject: Re: bug#72104: [PATCH] xwidget: Fix xwidget-at misinterpreting
 non-xwidget text-properties
Date: Mon, 24 Feb 2025 15:20:16 -0600
forcemerge 72848 72104
thanks

George Huebner <george <at> feyor.sh> writes:

> This patch was already accepted in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72848.
> Thank you for following up though!

OK, thanks.  I'm therefore merging these two bugs.




Forcibly Merged 72104 72848. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 24 Feb 2025 21:28:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 25 Mar 2025 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.