-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent constructing or setting attribute with invalid cell_val_num. (#…
…4952) While working on the Rust API I observed that the following code would error when `datatype == Datatype::Any`: ``` AttributeBuilder::new(context, field.name(), datatype)? .nullability(field.is_nullable())? .cell_val_num(cell_val_num)? ``` the error arises in the call to core function `set_cell_val_num`, which errors out if the datatype is `ANY`, even if you set to `constants::var_num` which is required for `ANY`. From there I noticed that it is also possible to construct an Attribute with an invalid cell val num, e.g. construct an `ANY` attribute with a non-var cell val num. This pull request adds the `check_cell_val_num` function and moves all associated error-checking logic into it, then calls this function from all of the `Attribute` constructors as well as `set_cell_val_num`. --- TYPE: BUG DESC: Prevent constructing attribute with invalid cell_val_num.
- Loading branch information
Showing
4 changed files
with
417 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.