Skip to content

Fix descriptor validation logic for packed enum fields.#39

Merged
xfxyjwf merged 1 commit intoprotocolbuffers:masterfrom
xfxyjwf:fix24
Oct 3, 2014
Merged

Fix descriptor validation logic for packed enum fields.#39
xfxyjwf merged 1 commit intoprotocolbuffers:masterfrom
xfxyjwf:fix24

Conversation

@xfxyjwf
Copy link
Copy Markdown
Contributor

@xfxyjwf xfxyjwf commented Oct 2, 2014

Reviewers: @pherl @protobufel

Fixes #24

The original validation code tries to access the "FieldDescriptor.type" field which for enum fields may only be available after cross-link and thus may result in a NullPointerException. This change fixes the problem by moving the validation logic to the cross-link phase.

Note that this problem only occurs for users who manually construct FileDescriptorProto. The FileDescriptorProto generated by protocol compiler already has the "type" field filled even for enum/message/group fields so it doesn't have such problems.

@liujisi
Copy link
Copy Markdown
Contributor

liujisi commented Oct 3, 2014

LGTM

xfxyjwf added a commit that referenced this pull request Oct 3, 2014
Fix descriptor validation logic for packed enum fields.
@xfxyjwf xfxyjwf merged commit 0dd3fef into protocolbuffers:master Oct 3, 2014
@przole przole mentioned this pull request Apr 14, 2021
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.

Descriptors$FieldDescriptor.<init>(Descriptors.java:1107) isPacked() NPE

2 participants