0.9.8.6:
authorJuho Snellman <jsnell@iki.fi>
Fri, 30 Dec 2005 00:21:40 +0000 (00:21 +0000)
committerJuho Snellman <jsnell@iki.fi>
Fri, 30 Dec 2005 00:21:40 +0000 (00:21 +0000)
        Make the count of fasl header counted strings a 32-bit value
        also on 64-bit platforms.  This ensures that a x86-64 SBCL can
        gracefully detect an error when trying to read a x86 fasl
        instead of choking on a ridiculously long counted string.

src/code/early-fasl.lisp
src/code/load.lisp
src/compiler/dump.lisp
version.lisp-expr

index 52a21aa..b55311d 100644 (file)
@@ -76,7 +76,7 @@
 ;;; versions which break binary compatibility. But it certainly should
 ;;; be incremented for release versions which break binary
 ;;; compatibility.
-(def!constant +fasl-file-version+ 61)
+(def!constant +fasl-file-version+ 62)
 ;;; (record of versions before 2003 deleted in 2003-04-26/0.pre8.107 or so)
 ;;; 38: (2003-01-05) changed names of internal SORT machinery
 ;;; 39: (2003-02-20) in 0.7.12.1 a slot was added to
 ;;; 60: (2005-10-24) Bumped for 0.9.6
 ;;; 61: (2005-11-06) Improved source location recording added extra parameters
 ;;;     to multiple %DEFMUMBLE functions.
+;;; 62: (2005-12-30) Make the count of FASL header counted strings
+;;;     a 32-bit value also on 64-bit platforms.
 
 ;;; the conventional file extension for our fasl files
 (declaim (type simple-string *fasl-file-type*))
index eafe8a0..b21c7dd 100644 (file)
   (declare (optimize (speed 0)))
   (read-arg #.sb!vm:n-word-bytes))
 
+(defun read-unsigned-byte-32-arg ()
+  (declare (optimize (speed 0)))
+  (read-arg 4))
+
 \f
 ;;;; the fop table
 
 
       ;; Read and validate version-specific compatibility stuff.
       (flet ((string-from-stream ()
-               (let* ((length (read-word-arg))
+               (let* ((length (read-unsigned-byte-32-arg))
                       (result (make-string length)))
                  (read-string-as-bytes stream result)
                  result)))
index 24cee41..cbf4323 100644 (file)
     (dotimes (i sb!vm:n-word-bytes)
       (write-byte (ldb (byte 8 (* 8 i)) num) stream))))
 
+;; Dump a 32-bit integer.
+(defun dump-unsigned-byte-32 (num fasl-output)
+  (declare (type sb!vm:word num))
+  (declare (type fasl-output fasl-output))
+  (let ((stream (fasl-output-stream fasl-output)))
+    (dotimes (i 4)
+      (write-byte (ldb (byte 8 (* 8 i)) num) stream))))
+
 ;;; Dump NUM to the fasl stream, represented by N bytes. This works
 ;;; for either signed or unsigned integers. There's no range checking
 ;;; -- if you don't specify enough bytes for the number to fit, this
     ;; Finish the header by outputting fasl file implementation,
     ;; version, and key *FEATURES*.
     (flet ((dump-counted-string (string)
-             (dump-word (length string) res)
+             ;; The count is dumped as a 32-bit unsigned-byte even on 64-bit
+             ;; platforms. This ensures that a x86-64 SBCL can gracefully
+             ;; detect an error when trying to read a x86 fasl, instead
+             ;; of choking on a ridiculously long counted string.
+             ;;  -- JES, 2005-12-30
+             (dump-unsigned-byte-32 (length string) res)
              (dotimes (i (length string))
                (dump-byte (char-code (aref string i)) res))))
       (dump-counted-string (symbol-name +backend-fasl-file-implementation+))
index 7038088..0d64e9f 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.8.5"
+"0.9.8.6"