MCPcopy Create free account
hub / github.com/apache/fory / reserve_map

Function reserve_map

cpp/fory/serialization/map_serializer.h:85–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83
84template <typename MapType>
85inline bool reserve_map(MapType &map, ReadContext &ctx, uint32_t length) {
86 // Lazy error propagation may continue into later readers; do not let that
87 // path retain attacker-controlled capacity after an earlier read failure.
88 if (FORY_PREDICT_FALSE(ctx.has_error())) {
89 return false;
90 }
91 if (FORY_PREDICT_FALSE(!ctx.buffer().ensure_readable(length, ctx.error()))) {
92 return false;
93 }
94 MapReserver<MapType>::reserve(map, length);
95 return true;
96}
97
98/// write chunk size at header offset
99inline void write_chunk_size(WriteContext &ctx, size_t header_offset,

Callers 4

read_configured_map_dataFunction · 0.85
read_map_data_fastFunction · 0.85
read_map_data_slowFunction · 0.85

Calls 4

ensure_readableMethod · 0.80
errorMethod · 0.65
has_errorMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected