Repository navigation
fix(metadata): validate format versions in JSON, builders, and properties - #1162
Merged
Merged
Conversation
manuzhang
force-pushed
the
fix/json-format-version-parsing
branch
from
November 24, 2026 04:11
c72f281 to
e2314d9
Compare
manuzhang
force-pushed
the
fix/json-format-version-parsing
branch
2 times, most recently
from
November 24, 2026 08:13
7d20668 to
2518056
Compare
manuzhang
marked this pull request as ready for review
November 24, 2026 08:13
manuzhang
force-pushed
the
fix/json-format-version-parsing
branch
2 times, most recently
from
November 24, 2026 09:40
5315069 to
9d7b757
Compare
manuzhang
force-pushed
the
fix/json-format-version-parsing
branch
from
November 24, 2026 09:47
9d7b757 to
33a30ba
Compare
manuzhang
force-pushed
the
fix/json-format-version-parsing
branch
from
November 24, 2026 09:51
33a30ba to
7b8473a
Compare
zhjwpku
reviewed
Nov 24, 2026
|
|
||
| Status TableMetadataBuilder::Impl::UpgradeFormatVersion(int8_t new_format_version) { | ||
| // Check that the new format version is supported | ||
| if (new_format_version > TableMetadata::kSupportedTableFormatVersion) { |
Member
Author
There was a problem hiding this comment.
Yes, we didn't check whether new_format_version is less than 1 or not.
Member
There was a problem hiding this comment.
We checked new_format_version should be >= metadata_.format_version below, but I'm fine with this
| return JsonParseError("Cannot read unsupported version: {}", | ||
| table_metadata->format_version); | ||
| ICEBERG_ASSIGN_OR_RAISE(auto format_version, | ||
| GetJsonInteger<int32_t>(json, kFormatVersion)); |
Member
There was a problem hiding this comment.
It's int32_t here, so I think int32_t should be enough for IsSupportedFormatVersion too?
Member
Author
There was a problem hiding this comment.
In a second thought, I think it would be better to use consistently use int8_t.
…ties Require format-version in table metadata and upgrade actions to be an exact JSON integer in the int8_t range. Validate the supported version when loading metadata and when building or upgrading tables. Share the int8_t supported-range predicate across metadata parsing, creation, builders, and property updates. Check wider property values before narrowing so out-of-range inputs cannot alias supported versions. Cover JSON type and range errors, invalid builder versions, and nonpositive version properties. Update the REST parse-error assertion. Co-authored-by: Codex <codex@openai.com>
manuzhang
force-pushed
the
fix/json-format-version-parsing
branch
from
November 24, 2026 13:12
7b8473a to
5f7e204
Compare
wgtmac
approved these changes
Nov 24, 2026
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.
Why
JSON conversion could truncate a fractional
format-versionor narrow an out-of-range integer into a supported version. For example,2.5,258, and-254could all be read as version 2. A negative version supplied through a table property could also wrap into a supported version.What
format-versionin table metadata and upgrade actions withGetJsonInteger<int8_t>. This rejects noninteger values and integers outside theint8_trange before conversion.TableMetadata::IsSupportedFormatVersion(int8_t)sits next tokSupportedTableFormatVersion. Callers with wider property values check that they fit inint8_tbefore converting.Validation
Local validation passed for table, JSON, catalog, REST, C++20, and 17 property-update tests, plus pre-commit. REST had one existing skip.