| 83 | |
| 84 | template <typename MapType> |
| 85 | inline 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 |
| 99 | inline void write_chunk_size(WriteContext &ctx, size_t header_offset, |
no test coverage detected