chicken-hackers
[Top][All Lists]
Advanced

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

[PATCH] Fix crash when accessing block header of immediate values in pre


From: Evan Hanson
Subject: [PATCH] Fix crash when accessing block header of immediate values in pretty-printer
Date: Wed, 21 Oct 2020 20:20:51 +1300

This fixes a segmentation fault when pretty-printing C_SCHEME_UNBOUND,
since we reach into the value with C_block_header() in C_anypointerp()
before checking for C_unboundvaluep(). This crashes, since unbound is an
immediate value.

In addition to moving the call to C_unboundvaluep() above the call to
C_anypointerp(), this also adds a generic check for any other immediate
values before the remaining cases, which handle non-immediate objects.
---
 extras.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/extras.scm b/extras.scm
index 76c23a21..cc679697 100644
--- a/extras.scm
+++ b/extras.scm
@@ -356,9 +356,9 @@
                                             (out (number->string code 16) col) 
]
                                            [else (out (make-string 1 obj) 
col)] ) ) ) )
            ((##core#inline "C_undefinedp" obj) (out "#<unspecified>" col))
+           ((##core#inline "C_unboundvaluep" obj) (out "#<unbound value>" col))
+           ((##core#inline "C_immp" obj) (out "#<unprintable object>" col))
            ((##core#inline "C_anypointerp" obj) (out (##sys#pointer->string 
obj) col))
-           ((##core#inline "C_unboundvaluep" obj)
-            (out "#<unbound value>" col) )
            ((##sys#generic-structure? obj)
             (let ([o (open-output-string)])
               (##sys#user-print-hook obj #t o)
-- 
2.28.0




reply via email to

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