From 7770c939c37f3239df1e6badc2645681ee51c113 Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Fri, 9 Feb 2024 10:49:24 +0100 Subject: [PATCH] fix a potential segfault inside SGDeviceModel::ParseFirmware --- CHANGELOG.md | 8 ++++++++ .../Private/SGCoreImpl/SGExportedFunctions.cpp | 9 ++++----- .../Public/SGCoreImpl/SGExportedFunctions.h | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d20ad81..a27c919f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +This is a bugfix release. + +### Fixed + +- Fix a wrong type-casting inside SGDeviceModel::ParseFirmware where OutMainVersion and OutSubVersion arguments are getting passed to the lower levels of the API. This could potentially result in a segfault at the FFI boundary between lower and higher levels of the API. + ## [1.9.4] - 2024-02-08 This is a bugfix release addressing mostly Blueprint API issues with ABI breaking changes inside the Blueprint layer, backported from the next major release of the plugin as documented below. diff --git a/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp b/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp index 4bc44b1d..7a9e40fa 100644 --- a/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp +++ b/Source/SenseGloveCoreImpl/Private/SGCoreImpl/SGExportedFunctions.cpp @@ -106,7 +106,6 @@ #include "SGInterop/SGIC_FSGTimedThumpCommandImpl.h" #include "SGInterop/SGIC_FString.h" #include "SGInterop/SGIC_FVector.h" -#include "SGInterop/SGIC_int32_Ref.h" #if PLATFORM_ANDROID #include "SGInterop/SGIC_jclass.h" @@ -1243,13 +1242,13 @@ void SGCoreImpl_FSGDeviceModelImpl_ParseFunctions( void SGCoreImpl_FSGDeviceModelImpl_ParseFirmware( void* RawFirmware, - void* OutMainVersion, - void* OutSubVersion) + int32* OutMainVersion, + int32* OutSubVersion) { FSGDeviceModelImpl::ParseFirmware( StaticCast(RawFirmware)->String, - StaticCast(OutMainVersion)->Ref, - StaticCast(OutSubVersion)->Ref); + *OutMainVersion, + *OutSubVersion); } void SGCoreImpl_FSGDeviceModelImpl_ctor( diff --git a/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h b/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h index ff8c2c5d..fef8607e 100644 --- a/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h +++ b/Source/SenseGloveCoreImpl/Public/SGCoreImpl/SGExportedFunctions.h @@ -630,8 +630,8 @@ SENSEGLOVECOREIMPL_PUBLIC_API void SGCoreImpl_FSGDeviceModelImpl_ParseFunctions( SENSEGLOVECOREIMPL_PUBLIC_API void SGCoreImpl_FSGDeviceModelImpl_ParseFirmware( void* RawFirmware, - void* OutMainVersion, - void* OutSubVersion); + int32* OutMainVersion, + int32* OutSubVersion); SENSEGLOVECOREIMPL_PUBLIC_API void SGCoreImpl_FSGDeviceModelImpl_ctor( void* OutDeviceModelImpl);