mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 13:38:19 +00:00
fix other instances of GetField().get() assuming long-lived ValPtr's
This commit is contained in:
parent
963d50bd48
commit
84a56e353e
2 changed files with 6 additions and 5 deletions
|
@ -128,12 +128,12 @@ bool File::UpdateConnectionFields(Connection* conn, bool is_orig)
|
||||||
if ( ! conn )
|
if ( ! conn )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Val* conns = val->GetField(conns_idx).get();
|
auto conns = val->GetField(conns_idx);
|
||||||
|
|
||||||
if ( ! conns )
|
if ( ! conns )
|
||||||
{
|
{
|
||||||
auto ect = empty_connection_table();
|
auto ect = empty_connection_table();
|
||||||
conns = ect.get();
|
conns = ect;
|
||||||
val->Assign(conns_idx, std::move(ect));
|
val->Assign(conns_idx, std::move(ect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ void File::InferMetadata()
|
||||||
{
|
{
|
||||||
did_metadata_inference = true;
|
did_metadata_inference = true;
|
||||||
|
|
||||||
Val* bof_buffer_val = val->GetField(bof_buffer_idx).get();
|
auto bof_buffer_val = val->GetField(bof_buffer_idx);
|
||||||
|
|
||||||
if ( ! bof_buffer_val )
|
if ( ! bof_buffer_val )
|
||||||
{
|
{
|
||||||
|
@ -318,7 +318,7 @@ void File::InferMetadata()
|
||||||
|
|
||||||
String* bs = concatenate(bof_buffer.chunks);
|
String* bs = concatenate(bof_buffer.chunks);
|
||||||
val->Assign(bof_buffer_idx, bs);
|
val->Assign(bof_buffer_idx, bs);
|
||||||
bof_buffer_val = val->GetField(bof_buffer_idx).get();
|
bof_buffer_val = val->GetField(bof_buffer_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! FileEventAvailable(file_sniff) )
|
if ( ! FileEventAvailable(file_sniff) )
|
||||||
|
|
|
@ -80,7 +80,8 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool
|
||||||
|
|
||||||
if ( same_type(val->GetType(), zeek::Broker::detail::DataVal::ScriptDataType()) )
|
if ( same_type(val->GetType(), zeek::Broker::detail::DataVal::ScriptDataType()) )
|
||||||
{
|
{
|
||||||
auto dv = static_cast<zeek::Broker::detail::DataVal*>(val->AsRecordVal()->GetField(0).get());
|
auto valptr = val->AsRecordVal()->GetField(0);
|
||||||
|
auto dv = static_cast<zeek::Broker::detail::DataVal*>(valptr.get());
|
||||||
auto val_from_data = dv->castTo(i->GetType().get());
|
auto val_from_data = dv->castTo(i->GetType().get());
|
||||||
|
|
||||||
if ( ! val_from_data )
|
if ( ! val_from_data )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue