Skip to content

Assert failure on Ventura #8

Open
@mstone2001

Description

@mstone2001

When running on macOS Ventura I get the following assertion failure:

dmidecode 3.1

Getting SMBIOS data from Apple SMBIOS service.
Assertion failed: (range.location + range.length <= dataLength), function __CFDataValidateRange, file CFData.c, line 235.
zsh: abort dmidecode

Tracing this back the root cause was the CFDataRef was 31 bytes instead of 32. Viewing the apple documentation the correct fix is it should use the CFDataGetLength call to get the actual size rather than hardcoding it. I also had to add an ifdef to remove the Problematic CFRelease(properties) as per the comments. I believe this should be a compile option for the Makefile, as I don't need a signed binary. Here is a diff of my version:

diff --git a/dmidecode.c b/dmidecode.c
index bb651da..194108c 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4811,8 +4811,10 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
 		 * This CFRelease throws 'Segmentation fault: 11' since macOS 10.12, if
 		 * the compiled binary is not signed with an Apple developer profile.
 		 */
+		#ifdef SIGNED_BINARY  // So don't do that unless you signed it
 		if (NULL != properties)
 			CFRelease(properties);
+		#endif
 
 		IOObjectRelease(service);
 	}
@@ -5147,7 +5149,7 @@ int main(int argc, char * const argv[])
 		goto exit_free;
 	}
 
-	CFDataGetBytes(dataRef, CFRangeMake(0, 0x20), (UInt8*)buf);
+	CFDataGetBytes(dataRef, CFRangeMake(0, CFDataGetLength(dataRef)), (UInt8*)buf);
 
 	if (NULL != dataRef)
 		CFRelease(dataRef);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions