Skip to content

fix(openapi): guard non-struct kind in getContentID ref loop#76

Merged
Alonza0314 merged 2 commits into
free5gc:mainfrom
neelareddybollu:fix/getcontentid-struct-guard
Jun 22, 2026
Merged

fix(openapi): guard non-struct kind in getContentID ref loop#76
Alonza0314 merged 2 commits into
free5gc:mainfrom
neelareddybollu:fix/getcontentid-struct-guard

Conversation

@neelareddybollu

Copy link
Copy Markdown
Contributor

Fixes free5gc/free5gc#1040 and free5gc/free5gc#1041.

FieldByName and Type().NumField() are only valid on struct kinds. A non-struct value at this point means the ref path resolved to a leaf before all components were consumed. Adding an IsValid+Kind guard at the top of the for loop prevents panics in all three FieldByName call sites within the loop body.

Fixes free5gc/free5gc#1040 and free5gc/free5gc#1041.

FieldByName and Type().NumField() are only valid on struct kinds. A non-struct value at this point means the ref path resolved to a leaf before all components were consumed. Adding an IsValid+Kind guard at the top of the for loop prevents panics in all three FieldByName call sites within the loop body.
@roundspring2003

Copy link
Copy Markdown
Contributor

@wiwi878 @chchen7 PTAL

@roundspring2003

Copy link
Copy Markdown
Contributor

Hi @neelareddybollu, can you help me to trim the comment?

@neelareddybollu

Copy link
Copy Markdown
Contributor Author

Done, trimmed to a single line in the latest commit. Thanks for the feedback!

@d11nn d11nn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Alonza0314 Alonza0314 merged commit 59253cf into free5gc:main Jun 22, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

[Bugs] MultiNF openapi getContentID L267 zero reflect value panic

4 participants