Skip to content

Conversation

yorickhardy
Copy link
Contributor

These commits attempt to address 2 issues:

  1. When checking the available stack space for allocation, use the total size of the allocation instead of string or bytevector (or vector) lengths.
  2. Rework string-append and bytevector-append to use alloc_string and alloc_bytevector so that the results are now correctly allocated on the stack or heap.

Tested in icyc with:

;; loops past the problem points in issue 560
(define s "1234567890")
(let loop ((a s))
   (display (string-length a))
   (newline)
   (loop (string-append a s)))

;; loops past the problem points in issue 560
(define s #u8(1 2 3 4 5 6 7 8 9 0))
(let loop ((a s))
  (display (bytevector-length a))
  (newline)
  (loop (bytevector-append a s)))

;; fails at length 147830
(define s #(1 2 3 4 5 6 7 8 9 0))
  (let loop ((a s))
    (display (vector-length a))
    (newline)
    (loop (vector-append a s)))

…e (list->vector)

"vector-append" can still fail, since it is implemented using "append", maybe some
stack checks are also required for the list operations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant