From a7b62778411df682e228b7989f93a0afebe9117e Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Tue, 11 Dec 2018 15:32:34 +0000 Subject: [PATCH] Tweak fasdumper to null-terminate bytevectors too. find_primitive relies on symbol names (which were formerly `strings', i.e. `vector-8b' or TC_CHARACTER_STRING, and are now `bytevectors') to be null-terminated. Rather than try to figure out which ones are primitive names and which ones are not, we'll just null-terminate all of them. We can undo this if we change find_primitive. (We need to change the compile-time tool findprim.c anyway because its strcmp_ci misuses islower/toupper.) --- src/compiler/base/fasdump.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/base/fasdump.scm b/src/compiler/base/fasdump.scm index 3b6411a4b..e4228902d 100644 --- a/src/compiler/base/fasdump.scm +++ b/src/compiler/base/fasdump.scm @@ -443,7 +443,10 @@ USA. (define (fasdump-bytevector-n-words format bytevector) (let ((n-bytes (bytevector-length bytevector))) - (quotient (+ n-bytes (- (format.bytes-per-word format) 1)) + ;; Add a terminating null byte. Bytevectors don't actually require + ;; this in general -- but the bytevectors that are symbol names do. + ;; This is pretty kludgey. + (quotient (+ 1 n-bytes (- (format.bytes-per-word format) 1)) (format.bytes-per-word format)))) (define (fasdump-bytevector state bytevector) -- 2.25.1