Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow writing too-large integers with a warning #1782

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions arrows/klv/klv_data_format.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ size_t
klv_uint_format
::length_of_typed( uint64_t const& value ) const
{
return m_length_constraints.fixed_or( klv_int_length( value ) );
auto const int_length = klv_int_length( value );
return std::max( m_length_constraints.fixed_or( 1 ), int_length );
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -277,7 +278,8 @@ size_t
klv_sint_format
::length_of_typed( int64_t const& value ) const
{
return m_length_constraints.fixed_or( klv_int_length( value ) );
auto const int_length = klv_int_length( value );
return std::max( m_length_constraints.fixed_or( 1 ), int_length );
}

// ----------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions doc/release-notes/master.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ Arrows: KLV

* Implemented metadata_map_io_csv.load_().

* Modified flint/IMAP behavior to print a warning when writing values with
incorrect lengths instead of correcting the length and possibly losing data.
* Modified flint, IMAP, and integer behavior to print a warning when writing
values with incorrect lengths instead of correcting the length and possibly
losing data.