A hack / workaround for google/protobuf#1450, to get a stock version of Protocol Buffers 2.6.1 to work under UBSan. This is useful for (e.g.) building applications on Ubuntu 14.04 or 16.04, where you want to continue using the distro-provided protobuf library packaging instead of upgrading or patching the source.
There are two steps.
Replace every 16
in the generated .pb.cc
files with this
. For example, if you use GNU Make to generate your .pb.cc
files:
%.pb.cc %.pb.h %_pb2.py: %.proto