Repository navigation
Conversation
Manifest and manifest list readers cast raw integers from the file straight into ManifestStatus, DataFile::Content and ManifestContent. Out-of-range values then reached switches ending in unreachable(), which is undefined behavior. Validate these fields through the *FromInt helpers at parse time, and return an error instead of unreachable() for an unknown status in ManifestWriter::WriteEntry.
gty404
force-pushed
the
fix/manifest-enum-validation
branch
from
October 18, 2026 05:40
6954c09 to
559066f
Compare
shangxinli
reviewed
Oct 19, 2026
| field_name, required)); | ||
| ICEBERG_RETURN_UNEXPECTED( | ||
| ParseEnumField(DataFileContentFromInt, field_view, manifest_entries, | ||
| proj_data_file(&DataFile::content), field_name, required)); |
Contributor
There was a problem hiding this comment.
The file_format case just below has no else-if-required branch, so a null in that required field silently keeps the default instead of returning MakeNullError the way every other field in this switch does.
Contributor
Author
There was a problem hiding this comment.
Good catch, thanks. Fixed in ea36a9c: the kFileFormatFieldId loop now checks required and returns MakeNullError for a null value, same as the other fields in this switch. Added a regression test (RejectsNullRequiredFileFormat) that writes a null file_format via a relaxed write-side schema (bypassing the writer's own non-null enforcement) and asserts the reader rejects it.
gty404
added a commit
to gty404/iceberg-cpp
that referenced
this pull request
Oct 20, 2026
ParseDataFile's hand-rolled loop for DataFile::kFileFormatFieldId skipped the field when null instead of checking `required` and returning MakeNullError like every other field in the switch, addressing review feedback on PR apache#1034. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ParseDataFile's hand-rolled loop for DataFile::kFileFormatFieldId skipped the field when null instead of checking `required` and returning MakeNullError like every other field in the switch, addressing review feedback on PR apache#1034.
gty404
force-pushed
the
fix/manifest-enum-validation
branch
from
October 20, 2026 02:30
ea36a9c to
ad1bc98
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ManifestReaderandManifestListReadercast raw integers from the file straight intoManifestStatus,DataFile::ContentandManifestContent. An out-of-range value in a manifest then reached switches that end inunreachable(), which is undefined behavior.ManifestStatusFromInt,DataFileContentFromIntand a newManifestContentFromInt, returningInvalidArgumentfor unknown values.ManifestWriter::WriteEntrynow returns an error instead ofstd::unreachable()for an unknown entry status.Test plan
data_file.content,statusand manifestcontent(bypassingManifestWriter) and assert the readers returnInvalidArgumentctest(all 20 test targets) passes locally