Skip to content

OpenSSF silver badge: Fix UB of different type names for C-API opaque types#1266

Merged
TonyXiang8787 merged 9 commits intomainfrom
fix/c-api-opaque-type
Jan 19, 2026
Merged

OpenSSF silver badge: Fix UB of different type names for C-API opaque types#1266
TonyXiang8787 merged 9 commits intomainfrom
fix/c-api-opaque-type

Conversation

@TonyXiang8787
Copy link
Member

@TonyXiang8787 TonyXiang8787 commented Jan 18, 2026

As discovered by #1241, this PR is a new proposal to fix the C-API opaque types issue by explicit casting, instead of defining child class as in #1264.

This is the standard way of avoiding the different type violation between user compilation and library compilation, used by many open-source projects.

Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
@TonyXiang8787 TonyXiang8787 requested a review from mgovers January 18, 2026 08:51
@TonyXiang8787 TonyXiang8787 self-assigned this Jan 18, 2026
@TonyXiang8787 TonyXiang8787 added bug Something isn't working improvement Improvement on internal implementation labels Jan 18, 2026
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
@TonyXiang8787 TonyXiang8787 changed the title Fix UB of ODR violation for C-API opaque types Fix UB of different type names for C-API opaque types Jan 18, 2026
@mgovers mgovers changed the title Fix UB of different type names for C-API opaque types OpenSSF silver badge: Fix UB of different type names for C-API opaque types Jan 19, 2026
Copy link
Member

@mgovers mgovers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review is OK. i will do some local checks to ensure:

  • that the issues found in #1241 are resolved in this branch
  • that there are no other changes in #1264 that are missing here

Signed-off-by: Tony Xiang <19280867+TonyXiang8787@users.noreply.github.com>
Copy link
Member

@mgovers mgovers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both local testing and the comparison with #1264 are done. The changes I did to #1264 that are still missing here are small and I will do those in a separate PR. No need to clutter this PR with those changes.

@sonarqubecloud
Copy link

@TonyXiang8787 TonyXiang8787 added this pull request to the merge queue Jan 19, 2026
Merged via the queue into main with commit 0cb095f Jan 19, 2026
30 of 31 checks passed
@TonyXiang8787 TonyXiang8787 deleted the fix/c-api-opaque-type branch January 19, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working improvement Improvement on internal implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants