File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -959,5 +959,16 @@ int verify_midx_file(const char *object_dir)
959959 i , oid_fanout1 , oid_fanout2 , i + 1 );
960960 }
961961
962+ for (i = 0 ; i < m -> num_objects - 1 ; i ++ ) {
963+ struct object_id oid1 , oid2 ;
964+
965+ nth_midxed_object_oid (& oid1 , m , i );
966+ nth_midxed_object_oid (& oid2 , m , i + 1 );
967+
968+ if (oidcmp (& oid1 , & oid2 ) >= 0 )
969+ midx_report (_ ("oid lookup out of order: oid[%d] = %s >= %s = oid[%d]" ),
970+ i , oid_to_hex (& oid1 ), oid_to_hex (& oid2 ), i + 1 );
971+ }
972+
962973 return verify_midx_error ;
963974}
Original file line number Diff line number Diff line change @@ -175,6 +175,7 @@ test_expect_success 'verify bad signature' '
175175 "multi-pack-index signature"
176176'
177177
178+ HASH_LEN=20
178179MIDX_BYTE_VERSION=4
179180MIDX_BYTE_OID_VERSION=5
180181MIDX_BYTE_CHUNK_COUNT=6
@@ -189,6 +190,8 @@ MIDX_BYTE_PACKNAME_ORDER=$(($MIDX_OFFSET_PACKNAMES + 2))
189190MIDX_OFFSET_OID_FANOUT=$(( $MIDX_OFFSET_PACKNAMES + 652 ))
190191MIDX_OID_FANOUT_WIDTH=4
191192MIDX_BYTE_OID_FANOUT_ORDER=$(( MIDX_OFFSET_OID_FANOUT + 250 * $MIDX_OID_FANOUT_WIDTH + 1 ))
193+ MIDX_OFFSET_OID_LOOKUP=$(( $MIDX_OFFSET_OID_FANOUT + 256 * $MIDX_OID_FANOUT_WIDTH ))
194+ MIDX_BYTE_OID_LOOKUP=$(( $MIDX_OFFSET_OID_LOOKUP + 16 * $HASH_LEN ))
192195
193196test_expect_success ' verify bad version' '
194197 corrupt_midx_and_verify $MIDX_BYTE_VERSION "\00" $objdir \
@@ -235,6 +238,11 @@ test_expect_success 'verify oid fanout out of order' '
235238 "oid fanout out of order"
236239'
237240
241+ test_expect_success ' verify oid lookup out of order' '
242+ corrupt_midx_and_verify $MIDX_BYTE_OID_LOOKUP "\00" $objdir \
243+ "oid lookup out of order"
244+ '
245+
238246test_expect_success ' repack removes multi-pack-index' '
239247 test_path_is_file $objdir/pack/multi-pack-index &&
240248 git repack -adf &&
You can’t perform that action at this time.
0 commit comments