From 8e088c75b2fa6ad56635c6c3340a40b4873b6b4e Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Thu, 3 Oct 2024 15:36:20 -0400 Subject: [PATCH] Fix bug where one too many indirections are used with pointer types --- CHANGELOG.md | 2 ++ src/clj/coffi/mem.clj | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9f1e85..32bc376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). ## [Unreleased] +### Fixed +- Bug where one too many indirections is used when serializing/deserializing pointer types ## [1.0.472] - 2024-10-03 ### Added diff --git a/src/clj/coffi/mem.clj b/src/clj/coffi/mem.clj index 7dde14a..955d821 100644 --- a/src/clj/coffi/mem.clj +++ b/src/clj/coffi/mem.clj @@ -876,7 +876,7 @@ (if (sequential? type) (let [segment (alloc-instance (second type) arena)] (serialize-into obj (second type) segment arena) - (address-of segment)) + segment) obj) null)) @@ -1082,7 +1082,7 @@ (if (sequential? type) (let [target-type (second type)] (deserialize-from - (.reinterpret ^MemorySegment (read-address addr) + (.reinterpret ^MemorySegment addr ^long (size-of target-type)) target-type)) addr)))