On a 32-bit build, sizeof(upb_Array) was not aligned to 8, and so we were allocating a block of memory that was too small.
Our 32-bit GitHub tests did not catch this, probably because the 32-bit build is not running ASAN. The bug manifested in the 32-bit PHP build.
PiperOrigin-RevId: 478488507
This commit makes a couple changes to allow staleness_test() to be used
from outside the upb repo:
- Fully qualify references to upb targets and wrap them in a Label()
constructor. See here for details:
https://bazel.build/extending/macros#label-resolution
- Make the :staleness_test_lib target public.
This renaming is something we have been planning on doing, and I would
like to do it now because I'm getting ready to rely on this
staleness_test() macro from the main protobuf repo.
Continuing the trend of giving individual build targets their own subdirs
where appropriate, and leaving behind temporary stub headers for compatibility.
JSON is a particularly good choice for this because of how little interaction
it has with the rest of upb.
PiperOrigin-RevId: 476792865
Several data arrays that are used in only one function have been moved from file scope to the function that uses them.
Updated to use C99 array designators so we can specify values by array index. This is more readable and less error-prone than using comments to label each value.
There is no functional change for the vast majority of this CL. The only exception is that we now test for OOM when creating a map.
PiperOrigin-RevId: 475191072
Created a common function for saving/restoring the depth and checking end_group. This will be even more helpful if we decide to add any more state that is saved/resolved when we recurse into a sub-message.
This appears to be perf-neutral.
PiperOrigin-RevId: 475140169
If the extension MiniDescriptor did not contain any fields, we would read an uninitialized value. We need to add a check that the extension descriptor contains exactly one field.
PiperOrigin-RevId: 475075831
- Each def type has its own .c file and its own .h file
- Functions that require a builder context are declared in def_builder.h
- The mini descriptor encoders have also been pulled into upb/reflection/
- upb/def.h, upb/def.hpp, upb/reflection.h, and upb/reflection.hpp are now deprecated stubs that point to the new headers
PiperOrigin-RevId: 474459500
Ref: https://github.com/protocolbuffers/protobuf/pull/10291
Ruby types defined though native extensions should register
a function that report their memory footprint in bytes.
This feature is used by various memory profiling tools.