Skip to content

Commit eff5832

Browse files
hanwengitster
authored andcommitted
reftable: reject 0 object_id_len
The spec says 2 <= object_id_len <= 31. We are lenient and allow 1, but we forbid 0, so we can be sure that we never read a 0-length key. Signed-off-by: Han-Wen Nienhuys <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fa48de6 commit eff5832

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

reftable/reader.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ static int parse_footer(struct reftable_reader *r, uint8_t *footer,
155155
r->log_offsets.is_present = (first_block_typ == BLOCK_TYPE_LOG ||
156156
r->log_offsets.offset > 0);
157157
r->obj_offsets.is_present = r->obj_offsets.offset > 0;
158+
if (r->obj_offsets.is_present && !r->object_id_len) {
159+
err = REFTABLE_FORMAT_ERROR;
160+
goto done;
161+
}
162+
158163
err = 0;
159164
done:
160165
return err;

0 commit comments

Comments
 (0)