From: Noah Lavine <noah.b.lavine@gmail.com>
To: 13074@debbugs.gnu.org
Subject: bug#13074: VM Segfaults with Bad `Call' Instruction
Date: Tue, 4 Dec 2012 22:26:52 -0500 [thread overview]
Message-ID: <CA+U71=OV8MdGik5hwQPdP6CGso_Ry4MGOOHfgkyDvg2M8Ywb6A@mail.gmail.com> (raw)
In-Reply-To: <CA+U71=OuLMUTTA+OO=0JYXXRMV3P1TGPkcX8XP9ijXisf1a_uA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]
The following patch fixes the problem for me:
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index 7153ab5..dff2ab2 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -793,7 +793,9 @@ VM_DEFINE_INSTRUCTION (55, call, "call", 1, -1, 1)
VM_HANDLE_INTERRUPTS;
- if (SCM_UNLIKELY (!SCM_PROGRAM_P (program)))
+ if (SCM_UNLIKELY (program == NULL))
+ goto vm_error_bad_instruction;
+ else if (SCM_UNLIKELY (!SCM_PROGRAM_P (program)))
{
if (SCM_STRUCTP (program) && SCM_STRUCT_APPLICABLE_P (program))
{
Any objections if I apply it to stable-2.0? (Or master?)
Noah
On Mon, Dec 3, 2012 at 10:06 PM, Noah Lavine <noah.b.lavine@gmail.com>wrote:
> Hello,
>
> This is an interesting bug, because the only way to hit it (as far as I
> can tell) is to mess up when writing a compiler. However, I did mess up,
> and I discover that I can generate a `call' instruction in the trunk VM
> where the procedure to call will be 0x0. Then the VM will try to check
> whether the procedure is really a procedure, and Guile will segfault at
> line 796 of v-i-system.c.
>
> I think the correct behavior would be to throw a `vm-bad-instruction'
> error instead. The fix should be pretty simple - just check if program is
> 0x0 and jump to vm-bad-instruction in that case.
>
> Noah
>
>
[-- Attachment #2: Type: text/html, Size: 1990 bytes --]
next prev parent reply other threads:[~2012-12-05 3:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-04 3:06 bug#13074: VM Segfaults with Bad `Call' Instruction Noah Lavine
2012-12-05 3:26 ` Noah Lavine [this message]
2012-12-05 14:10 ` Ludovic Courtès
2012-12-05 14:54 ` Noah Lavine
2012-12-05 22:14 ` Ludovic Courtès
2012-12-11 4:16 ` Noah Lavine
2012-12-11 9:42 ` Ludovic Courtès
2012-12-11 13:32 ` Noah Lavine
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/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+U71=OV8MdGik5hwQPdP6CGso_Ry4MGOOHfgkyDvg2M8Ywb6A@mail.gmail.com' \
--to=noah.b.lavine@gmail.com \
--cc=13074@debbugs.gnu.org \
/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.
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).