* bug#25498: Crash in open-file; patch attached
@ 2017-01-21 0:34 Linas Vepstas
2017-02-11 21:10 ` Ludovic Courtès
2017-03-01 16:37 ` Andy Wingo
0 siblings, 2 replies; 5+ messages in thread
From: Linas Vepstas @ 2017-01-21 0:34 UTC (permalink / raw)
To: 25498
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 (mode=mode@entry=0x555555ac5660,
is_binary=is_binary@entry=0x7fffffffd46c,
FUNC_NAME=FUNC_NAME@entry=0x7ffff7b89a7d "open-file")
at ../../libguile/fports.c:168
168 switch (*md)
(gdb) bt
#0 scm_i_mode_to_open_flags (mode=mode@entry=0x555555ac5660,
is_binary=is_binary@entry=0x7fffffffd46c,
FUNC_NAME=FUNC_NAME@entry=0x7ffff7b89a7d "open-file")
at ../../libguile/fports.c:168
#1 0x00007ffff7b057e9 in scm_open_file_with_encoding (
filename=filename@entry=0x555555b7fd98, mode=mode@entry=0x555555ac5660,
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");
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#25498: Crash in open-file; patch attached
2017-01-21 0:34 bug#25498: Crash in open-file; patch attached Linas Vepstas
@ 2017-02-11 21:10 ` Ludovic Courtès
2017-02-15 8:25 ` Linas Vepstas
2017-03-01 16:37 ` Andy Wingo
1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2017-02-11 21:10 UTC (permalink / raw)
To: Linas Vepstas; +Cc: 25498
Hi Linas,
Linas Vepstas <linasvepstas@gmail.com> skribis:
> 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 (mode=mode@entry=0x555555ac5660,
> is_binary=is_binary@entry=0x7fffffffd46c,
> FUNC_NAME=FUNC_NAME@entry=0x7ffff7b89a7d "open-file")
> at ../../libguile/fports.c:168
What version of Guile are you using? With 2.0.13, I get:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (open-file "/tmp/lg" 'w')
ERROR: In procedure open-file:
ERROR: In procedure open-file: Value out of range: w'
--8<---------------cut here---------------end--------------->8---
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#25498: Crash in open-file; patch attached
2017-02-11 21:10 ` Ludovic Courtès
@ 2017-02-15 8:25 ` Linas Vepstas
2017-02-15 8:28 ` Linas Vepstas
0 siblings, 1 reply; 5+ messages in thread
From: Linas Vepstas @ 2017-02-15 8:25 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 25498
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
I'm using version 2.1 pulled from git, maybe a few days or week before the
bug was opened.
On Sat, Feb 11, 2017 at 3:10 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> Hi Linas,
>
> Linas Vepstas <linasvepstas@gmail.com> skribis:
>
> > 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 (mode=mode@entry=0x555555ac5660,
> > is_binary=is_binary@entry=0x7fffffffd46c,
> > FUNC_NAME=FUNC_NAME@entry=0x7ffff7b89a7d "open-file")
> > at ../../libguile/fports.c:168
>
> What version of Guile are you using? With 2.0.13, I get:
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> (open-file "/tmp/lg" 'w')
> ERROR: In procedure open-file:
> ERROR: In procedure open-file: Value out of range: w'
> --8<---------------cut here---------------end--------------->8---
>
> Ludo’.
>
[-- Attachment #2: Type: text/html, Size: 1680 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#25498: Crash in open-file; patch attached
2017-02-15 8:25 ` Linas Vepstas
@ 2017-02-15 8:28 ` Linas Vepstas
0 siblings, 0 replies; 5+ messages in thread
From: Linas Vepstas @ 2017-02-15 8:28 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 25498
[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]
Specifically, this crashes, now: GNU Guile 2.1.6.10-710eb
On Wed, Feb 15, 2017 at 2:25 AM, Linas Vepstas <linasvepstas@gmail.com>
wrote:
> I'm using version 2.1 pulled from git, maybe a few days or week before the
> bug was opened.
>
> On Sat, Feb 11, 2017 at 3:10 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Hi Linas,
>>
>> Linas Vepstas <linasvepstas@gmail.com> skribis:
>>
>> > 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 (mode=mode@entry=0x555555ac5660,
>> > is_binary=is_binary@entry=0x7fffffffd46c,
>> > FUNC_NAME=FUNC_NAME@entry=0x7ffff7b89a7d "open-file")
>> > at ../../libguile/fports.c:168
>>
>> What version of Guile are you using? With 2.0.13, I get:
>>
>> --8<---------------cut here---------------start------------->8---
>> scheme@(guile-user)> (open-file "/tmp/lg" 'w')
>> ERROR: In procedure open-file:
>> ERROR: In procedure open-file: Value out of range: w'
>> --8<---------------cut here---------------end--------------->8---
>>
>> Ludo’.
>>
>
>
[-- Attachment #2: Type: text/html, Size: 2192 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#25498: Crash in open-file; patch attached
2017-01-21 0:34 bug#25498: Crash in open-file; patch attached Linas Vepstas
2017-02-11 21:10 ` Ludovic Courtès
@ 2017-03-01 16:37 ` Andy Wingo
1 sibling, 0 replies; 5+ messages in thread
From: Andy Wingo @ 2017-03-01 16:37 UTC (permalink / raw)
To: Linas Vepstas; +Cc: 25498-done
On Sat 21 Jan 2017 01:34, Linas Vepstas <linasvepstas@gmail.com> writes:
> The following crashes instantly; I used single-quotes by accident.
>
> (open-file "/tmp/lg" 'w')
Fixed with a similar patch. Thanks :)
Andy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-01 16:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-21 0:34 bug#25498: Crash in open-file; patch attached Linas Vepstas
2017-02-11 21:10 ` Ludovic Courtès
2017-02-15 8:25 ` Linas Vepstas
2017-02-15 8:28 ` Linas Vepstas
2017-03-01 16:37 ` Andy Wingo
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).