diff options
author | Greg J. Badros <gjb@cs.washington.edu> | 2000-06-18 21:47:23 +0000 |
---|---|---|
committer | Greg J. Badros <gjb@cs.washington.edu> | 2000-06-18 21:47:23 +0000 |
commit | 0a284a4e88d63fccfe166998dcce0897f56a745d (patch) | |
tree | 996ec34b582b43a8dd2ce106a73e3fe4792b71d3 /libguile/print.c | |
parent | e8293eb67104a22599ae89a947072d795ce12983 (diff) | |
download | guile-0a284a4e88d63fccfe166998dcce0897f56a745d.tar.gz |
* print.c (s_scm_current_pstate): Do not segfault when the
print_state_pool is unitialized in `current-pstate', and better
verify its state before altering it in scm_make_print_state().
Diffstat (limited to 'libguile/print.c')
-rw-r--r-- | libguile/print.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libguile/print.c b/libguile/print.c index 9c03035da..9a5734446 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -193,6 +193,9 @@ SCM_DEFINE (scm_current_pstate, "current-pstate", 0, 0, 0, "`current-pstate' is only included in GUILE_DEBUG builds.") #define FUNC_NAME s_scm_current_pstate { + if (!print_state_pool || SCM_NCONSP(print_state_pool) + || SCM_NULLP(SCM_CDR(print_state_pool))) + return SCM_BOOL_F; return SCM_CADR (print_state_pool); } #undef FUNC_NAME @@ -222,7 +225,8 @@ scm_make_print_state () /* First try to allocate a print state from the pool */ SCM_DEFER_INTS; - if (SCM_NNULLP (SCM_CDR (print_state_pool))) + if (print_state_pool && SCM_CONSP(print_state_pool) && + SCM_NNULLP (SCM_CDR (print_state_pool))) { answer = SCM_CADR (print_state_pool); SCM_SETCDR (print_state_pool, SCM_CDDR (print_state_pool)); |