| 769 | }; |
| 770 | |
| 771 | static int compare_objects(const unsigned char *buf, unsigned long size, |
| 772 | void *cb_data) |
| 773 | { |
| 774 | struct compare_data *data = cb_data; |
| 775 | |
| 776 | if (data->buf_size < size) { |
| 777 | free(data->buf); |
| 778 | data->buf = xmalloc(size); |
| 779 | data->buf_size = size; |
| 780 | } |
| 781 | |
| 782 | while (size) { |
| 783 | ssize_t len = odb_read_stream_read(data->st, data->buf, size); |
| 784 | if (len == 0) |
| 785 | die(_("SHA1 COLLISION FOUND WITH %s !"), |
| 786 | oid_to_hex(&data->entry->idx.oid)); |
| 787 | if (len < 0) |
| 788 | die(_("unable to read %s"), |
| 789 | oid_to_hex(&data->entry->idx.oid)); |
| 790 | if (memcmp(buf, data->buf, len)) |
| 791 | die(_("SHA1 COLLISION FOUND WITH %s !"), |
| 792 | oid_to_hex(&data->entry->idx.oid)); |
| 793 | size -= len; |
| 794 | buf += len; |
| 795 | } |
| 796 | return 0; |
| 797 | } |
| 798 | |
| 799 | static int check_collison(struct object_entry *entry) |
| 800 | { |
nothing calls this directly
no test coverage detected