Merge remote-tracking branch 'origin/topic/jsiwek/fix-enumtype-shallow-clone'

* origin/topic/jsiwek/fix-enumtype-shallow-clone:
  Fix ref-counting bug in EnumType copy ctor
This commit is contained in:
Robin Sommer 2019-07-16 15:21:37 +00:00
commit a45cc53892
5 changed files with 22 additions and 1 deletions

View file

@ -1,4 +1,11 @@
2.6-616 | 2019-07-16 15:21:37 +0000
* Fix referecne counting bug in EnumType copy constructor. (Jon
Siwek, Corelight)
* Remove unused BroObj::in_ser_cache member. (Jon Siwek, Corelight)
2.6-612 | 2019-07-15 19:46:04 -0700 2.6-612 | 2019-07-15 19:46:04 -0700
* Fix a potential usage of List::remove_nth(-1) (Jon Siwek, Corelight) * Fix a potential usage of List::remove_nth(-1) (Jon Siwek, Corelight)

View file

@ -1 +1 @@
2.6-612 2.6-616

View file

@ -1088,6 +1088,9 @@ EnumType::EnumType(const EnumType* e)
names[it->first] = it->second; names[it->first] = it->second;
vals = e->vals; vals = e->vals;
for ( auto& kv : vals )
::Ref(kv.second);
} }
EnumType* EnumType::ShallowClone() EnumType* EnumType::ShallowClone()

View file

@ -0,0 +1 @@
ONE

View file

@ -0,0 +1,10 @@
# @TEST-EXEC: zeek -b %INPUT >out
# @TEST-EXEC: btest-diff out
# At the moment, it's legal to allow a double definitions. Internally, the
# reason/comment is: "so that we can define an enum both in a *.bif and *.zeek
# for avoiding cyclic dependencies."
type myenum: enum { ONE = 0x01 };
type myenum: enum { ONE = 0x01 };
print ONE;