From fad7073f108679cb6e7013f80ff2f691d34d1e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Mon, 11 Aug 2025 09:16:00 +0200 Subject: [PATCH] ffi: convert-to-foreign-string: ensure a cstring The function operates on base_string while if it was supplied with an extended string then ecl_base_char array became ecl_character, and that lead to bad copies. To fix it we ensure that the passes string is first coerced to cstring. --- src/lsp/ffi.lsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lsp/ffi.lsp b/src/lsp/ffi.lsp index 16f938a9e..4d7502910 100644 --- a/src/lsp/ffi.lsp +++ b/src/lsp/ffi.lsp @@ -473,9 +473,9 @@ translate ASCII and binary strings." Converts a Lisp string to a foreign string. Memory should be freed with free-foreign-object." - (let ((lisp-string (string string-designator)) + (let ((cstring (convert-to-cstring (string string-designator))) (foreign-type '(* :char))) - (c-inline (lisp-string foreign-type) (t t) t + (c-inline (cstring foreign-type) (t t) t "{ cl_object lisp_string = #0; cl_index size = lisp_string->base_string.fillp;