Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert failure on Ventura #8

Open
mstone2001 opened this issue Sep 2, 2023 · 2 comments
Open

Assert failure on Ventura #8

mstone2001 opened this issue Sep 2, 2023 · 2 comments

Comments

@mstone2001
Copy link

mstone2001 commented Sep 2, 2023

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);
@igavrysh
Copy link

Fix worked for my case! thx @mstone2001 for sharing and work!

@mstone2001
Copy link
Author

@igavrysh You are welcome. I have forked this repo myself and submitted a pull request, but I have not heard anything, so I wanted to at least share my fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants