From 286d265497a840f06e4ccb321c9bc81139d2e9a2 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 31 Jan 2025 21:56:21 -0500 Subject: Fix double free in CoreCallingConvention::callee_saved_registers Also added an assertion in the types unit test to catch it Fixes #6379 --- rust/tests/types.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'rust/tests') diff --git a/rust/tests/types.rs b/rust/tests/types.rs index f745de0c..98530dc6 100644 --- a/rust/tests/types.rs +++ b/rust/tests/types.rs @@ -1,4 +1,6 @@ +use binaryninja::confidence::Conf; use binaryninja::headless::Session; +use binaryninja::platform::Platform; use binaryninja::types::{MemberAccess, MemberScope, StructureBuilder, StructureMember, Type}; use rstest::*; @@ -12,6 +14,14 @@ fn session() -> Session { fn test_type_to_string(_session: &Session) { let test_type = Type::int(4, true); assert_eq!(test_type.to_string(), "int32_t".to_string()); + + let platform = Platform::by_name("x86").expect("Failed to get platform"); + let calling_conv = platform + .get_default_calling_convention() + .expect("Failed to get calling convention"); + let test_fn_type = + Type::function_with_opts(&test_type, &[], false, calling_conv, Conf::new(0, 0)); + assert_eq!(test_fn_type.to_string(), "int32_t()"); } #[rstest] -- cgit v1.3.1