emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#25498: closed (Crash in open-file; patch attached)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#25498: closed (Crash in open-file; patch attached)
Date: Wed, 01 Mar 2017 16:38:02 +0000

Your message dated Wed, 01 Mar 2017 17:37:09 +0100
with message-id <address@hidden>
and subject line Re: bug#25498: Crash in open-file; patch attached
has caused the debbugs.gnu.org bug report #25498,
regarding Crash in open-file; patch attached
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
25498: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25498
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Crash in open-file; patch attached Date: Fri, 20 Jan 2017 18:34:38 -0600
The following crashes instantly; I used single-quotes by accident.

(open-file "/tmp/lg" 'w')

Stack:

Enter `,help' for help.
scheme@(guile-user)> (open-file "/tmp/lg" 'w')

Thread 1 "guile" received signal SIGSEGV, Segmentation fault.
scm_i_mode_to_open_flags (address@hidden,
    address@hidden,
    address@hidden "open-file")
    at ../../libguile/fports.c:168
168  switch (*md)
(gdb) bt
#0  scm_i_mode_to_open_flags (address@hidden,
    address@hidden,
    address@hidden "open-file")
    at ../../libguile/fports.c:168
#1  0x00007ffff7b057e9 in scm_open_file_with_encoding (
    address@hidden, address@hidden,
    guess_encoding=0x4, encoding=0x4) at ../../libguile/fports.c:242
#2  0x00007ffff7b05b83 in scm_i_open_file (filename=0x555555b7fd98,
    mode=0x555555ac5660, keyword_args=<optimized out>)
    at ../../libguile/fports.c:380
#3  0x00007ffff7b6a221 in vm_debug_engine (thread=0x555555ac5660,
    vp=0x555555844f30, registers=0x54aad62357094bc, resume=39)
    at ../../libguile/vm-engine.c:760

A patch that seems reasonable to me:

$ git diff
diff --git a/libguile/fports.c b/libguile/fports.c
index 8fa69933d..28e666b6a 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -230,6 +230,9 @@ scm_open_file_with_encoding (SCM filename, SCM mode,
   unsigned int retries;
   char *file;

+  if (SCM_UNLIKELY (!scm_is_string (mode)))
+    scm_wrong_type_arg_msg (FUNC_NAME, 2, mode, "mode to be string");
+
   if (SCM_UNLIKELY (!(scm_is_false (encoding) || scm_is_string (encoding))))
     scm_wrong_type_arg_msg (FUNC_NAME, 0, encoding,
                             "encoding to be string or false");



--- End Message ---
--- Begin Message --- Subject: Re: bug#25498: Crash in open-file; patch attached Date: Wed, 01 Mar 2017 17:37:09 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
On Sat 21 Jan 2017 01:34, Linas Vepstas <address@hidden> writes:

> The following crashes instantly; I used single-quotes by accident.
>
> (open-file "/tmp/lg" 'w')

Fixed with a similar patch.  Thanks :)

Andy


--- End Message ---

reply via email to

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