Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-riehm committed May 22, 2023
2 parents 1be8de5 + 40de90e commit 80df6e6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
28 changes: 20 additions & 8 deletions arrows/core/derive_metadata.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,19 @@ get_sensor_location( kwiver::vital::metadata_sptr const& metadata )
kv::metadata_item const& item =
metadata->find( kv::VITAL_META_SENSOR_LOCATION );

if( !item || !std::isfinite( item.as_double() ) )
if( item )
{
VITAL_THROW( kv::invalid_value,
"metadata does not contain sensor location" );
auto const typed_item = item.get< kv::geo_point >();
if( std::isfinite( typed_item.location()[ 0 ] ) &&
std::isfinite( typed_item.location()[ 1 ] ) &&
std::isfinite( typed_item.location()[ 2 ] ) )
{
return typed_item;
}
}

return item.get< kv::geo_point >();
VITAL_THROW(
kv::invalid_value, "metadata does not contain sensor location" );
}

// ----------------------------------------------------------------------------
Expand All @@ -171,13 +177,19 @@ get_frame_center( kwiver::vital::metadata_sptr const& metadata )
kv::metadata_item const& item =
metadata->find( kv::VITAL_META_FRAME_CENTER );

if( !item || !std::isfinite( item.as_double() ) )
if( item )
{
VITAL_THROW( kv::invalid_value,
"metadata does not contain frame center" );
auto const typed_item = item.get< kv::geo_point >();
if( std::isfinite( typed_item.location()[ 0 ] ) &&
std::isfinite( typed_item.location()[ 1 ] ) &&
std::isfinite( typed_item.location()[ 2 ] ) )
{
return typed_item;
}
}

return item.get< kv::geo_point >();
VITAL_THROW(
kv::invalid_value, "metadata does not contain frame center" );
}

// ----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions doc/release-notes/release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Arrows: Core
* Fixed undefined behavior leading to a crash in track_features_core when the
track set remained empty after the first frame.

* Fixed an incorrect cast of a geo_point to double in derive_metadata.

Arrows: KLV

* Fixed possible out-of-bounds memory read leading to crash when KLV parsing
Expand Down

0 comments on commit 80df6e6

Please sign in to comment.