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

Fix offsets in selector_table #273

Merged
merged 1 commit into from
Jan 22, 2024
Merged

Fix offsets in selector_table #273

merged 1 commit into from
Jan 22, 2024

Conversation

hmelder
Copy link
Collaborator

@hmelder hmelder commented Jan 21, 2024

Seems like the NUL check and offsets are wrong here.

@hmelder hmelder merged commit 1f038ca into master Jan 22, 2024
47 checks passed
@hmelder hmelder deleted the small-fixups branch January 22, 2024 09:04
@triplef
Copy link
Member

triplef commented Jan 22, 2024

Good finds! Can you comment on what kinds of issues this might have caused at runtime?

@hmelder
Copy link
Collaborator Author

hmelder commented Jan 22, 2024

Can you comment on what kinds of issues this might have caused at runtime?

This one should only be relevant if you are using GCC (or an object file compiled using GCC), as it generates "*" for @encode(BOOL*), while Clang generates "^c" or "^C". When comparing type encodings, we check for both options.

		if ((*t1 == '*') && (*t2 != '*'))
		{
- 			if (*t2 == '^' && (((*(t2+1) == 'C') || (*(t2+2) == 'c'))))
+			if (*t2 == '^' && (((*(t2+1) == 'C') || (*(t2+1) == 'c'))))

Here we do not stop if the second string ends, but as the pointer increment is guarded by an additional check (See line 216), we keep comparing the next char from t1 with \0 until t1 is also \0.

-	while (('\0' != *t1) && ('\0' != *t1))
+	while (('\0' != *t1) && ('\0' != *t2))

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

Successfully merging this pull request may close these issues.

None yet

3 participants