Re: [PATCH] fix segfault in csi's ",d"

2023-06-19 Thread Peter Bex
On Mon, Jun 19, 2023 at 01:38:13PM +0200, felix.winkelm...@bevuta.com wrote:
> Attached patch fixes a segfault when trying to describe a brokwn weak
> ptr. I also added a clause in the case construct to dispatch on a
> described value to catch unknown immediate values instead of crashing
> in the locative test (which expects block values).

Thanks for fixing my oversight ;)

Good call on "hardening" it a bit against unexpected other values.

I've pushed the patch.

Cheers,
Peter


signature.asc
Description: PGP signature


Re: [PATCH] Add user-facing weak pair API

2023-06-19 Thread felix . winkelmann
> Attached are 5 patches to add the weak pair support.  I've also pushed
> this to the git repo under the "user-facing-weak-pairs" branch.

This branch has been merged into master. Thanks a lot for this excellent
piece of work, Peter!


cheers,
felix




[PATCH] fix segfault in csi's ",d"

2023-06-19 Thread felix . winkelmann
Attached patch fixes a segfault when trying to describe a brokwn weak
ptr. I also added a clause in the case construct to dispatch on a
described value to catch unknown immediate values instead of crashing
in the locative test (which expects block values).


felix
From 9b104e139f8dda862a3a78876b832514b0b1a76b Mon Sep 17 00:00:00 2001
From: felix 
Date: Mon, 19 Jun 2023 13:35:55 +0200
Subject: [PATCH] handle #!bwp in csi's "describe" function properly

also adds guard clause to avoid segfault for newly
introduced immediate types.
---
 csi.scm | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/csi.scm b/csi.scm
index ea618521..b3db4521 100644
--- a/csi.scm
+++ b/csi.scm
@@ -592,6 +592,9 @@ EOF
((eq? x #t) (fprintf out "boolean true~%"))
((eq? x #f) (fprintf out "boolean false~%"))
((null? x) (fprintf out "empty list~%"))
+((##core#inline "C_bwpp" x) 
+ ;; TODO: replace with bwp-object? later
+ (fprintf out "broken weak pointer~%"))
((eof-object? x) (fprintf out "end-of-file object~%"))
((eq? (##sys#void) x) (fprintf out "unspecified object~%"))
((fixnum? x)
@@ -657,6 +660,9 @@ EOF
   (##sys#slot x 7)
   (##sys#slot x 3)
   (##sys#peek-unsigned-integer x 0) ) )
+((not (##core#inline "C_blockp" x)) 
+ ;; catch immediates here, as ##sys#locative? crashes on non-block
+ (fprintf out "unknown immediate object~%"))
((##sys#locative? x)
 (fprintf out "locative~%  pointer ~X~%  index ~A~%  type ~A~%"
   (##sys#peek-unsigned-integer x 0)
-- 
2.33.0