util/fossilize_db: Don't corrupt keys during entry read.
We change the hash that is still used to set entry->key.
Fixes: d2d642cc01
"util/fossilize_db: Only allocate entries after full read."
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12725>
This commit is contained in:
parent
5610b5840d
commit
8de60a1654
|
@ -156,18 +156,18 @@ update_foz_index(struct foz_db *foz_db, FILE *db_idx, unsigned file_idx)
|
|||
offset += header->payload_size;
|
||||
parsed_offset = offset;
|
||||
|
||||
/* Truncate the entry's hash string to a 64bit hash for use with a
|
||||
* 64bit hash table for looking up file offsets.
|
||||
*/
|
||||
hash_str[16] = '\0';
|
||||
uint64_t key = strtoull(hash_str, NULL, 16);
|
||||
|
||||
struct foz_db_entry *entry = ralloc(foz_db->mem_ctx,
|
||||
struct foz_db_entry);
|
||||
entry->header = *header;
|
||||
entry->file_idx = file_idx;
|
||||
_mesa_sha1_hex_to_sha1(entry->key, hash_str);
|
||||
|
||||
/* Truncate the entry's hash string to a 64bit hash for use with a
|
||||
* 64bit hash table for looking up file offsets.
|
||||
*/
|
||||
hash_str[16] = '\0';
|
||||
uint64_t key = strtoull(hash_str, NULL, 16);
|
||||
|
||||
entry->offset = cache_offset;
|
||||
|
||||
_mesa_hash_table_u64_insert(foz_db->index_db, key, entry);
|
||||
|
|
Loading…
Reference in New Issue