unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: altermo31 via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 74555@debbugs.gnu.org
Subject: bug#74555: fix not checking if fixnat in Fmap_charset_chars
Date: Wed, 27 Nov 2024 09:41:48 +0000	[thread overview]
Message-ID: <ZOZUJcf1DTDG20TGdJykbvB9yO3wBRnlrgubqnIGl4SZIRG91W9gG620sThVku8uhS3YkGqwRPZfkSScQA0wIiY7kktHez__bn4FJDQ1Hcw=@proton.me> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 162 bytes --]

Problem:
Fmap_charset_chars's arguments from_code and to_code may be converted to unsigned numbers even if they're not fixnat.

Sulution:
Check that their fixnat.

[-- Attachment #1.2: Type: text/html, Size: 827 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-not-checking-if-fixnat.patch --]
[-- Type: text/x-patch; name=0001-Fix-not-checking-if-fixnat.patch, Size: 896 bytes --]

From 8d036862b48d57a5a848f1c0ebd4fd6c613539ca Mon Sep 17 00:00:00 2001
From: altermo <107814000+altermo@users.noreply.github.com>
Date: Wed, 27 Nov 2024 10:37:28 +0100
Subject: [PATCH] Fix not checking if fixnat

---
 src/charset.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/charset.c b/src/charset.c
index f7d80cc..37d08f2 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -819,6 +819,7 @@ TO-CODE, which are CHARSET code points.  */)
     from = CHARSET_MIN_CODE (cs);
   else
     {
+      CHECK_FIXNAT(from_code);
       from = XFIXNUM (from_code);
       if (from < CHARSET_MIN_CODE (cs))
 	from = CHARSET_MIN_CODE (cs);
@@ -827,6 +828,7 @@ TO-CODE, which are CHARSET code points.  */)
     to = CHARSET_MAX_CODE (cs);
   else
     {
+      CHECK_FIXNAT(to_code);
       to = XFIXNUM (to_code);
       if (to > CHARSET_MAX_CODE (cs))
 	to = CHARSET_MAX_CODE (cs);
-- 
2.47.1


             reply	other threads:[~2024-11-27  9:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27  9:41 altermo31 via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-30 10:56 ` bug#74555: fix not checking if fixnat in Fmap_charset_chars Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ZOZUJcf1DTDG20TGdJykbvB9yO3wBRnlrgubqnIGl4SZIRG91W9gG620sThVku8uhS3YkGqwRPZfkSScQA0wIiY7kktHez__bn4FJDQ1Hcw=@proton.me' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74555@debbugs.gnu.org \
    --cc=altermo31@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).