chicken-hackers
[Top][All Lists]
Advanced

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

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


From: megane
Subject: Re: [PATCH] Fix crash when accessing block header of immediate values in pretty-printer
Date: Wed, 23 Dec 2020 15:47:58 +0200
User-agent: mu4e 1.0; emacs 27.1

Thanks, applied.
I added your example as a test.

Evan Hanson <evhan@foldling.org> writes:

> 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)




reply via email to

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