summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gentoo.org>2021-09-22 14:15:28 -0700
committerMatt Turner <mattst88@gentoo.org>2021-09-22 14:22:30 -0700
commit417c6adf5fd72af2160f0b2c251bacb58f0307a4 (patch)
tree7f662d42433b0372bf122db7bd2b3282d9c9ac16 /media-libs/mesa/files
parentx11-libs/libva: destabilize 2.13.0 for ~x86 (diff)
downloadgentoo-417c6adf5fd72af2160f0b2c251bacb58f0307a4.tar.gz
gentoo-417c6adf5fd72af2160f0b2c251bacb58f0307a4.tar.bz2
gentoo-417c6adf5fd72af2160f0b2c251bacb58f0307a4.zip
media-libs/mesa: Add patch to prevent fossil_db problems
Signed-off-by: Matt Turner <mattst88@gentoo.org>
Diffstat (limited to 'media-libs/mesa/files')
-rw-r--r--media-libs/mesa/files/21.1.8-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/media-libs/mesa/files/21.1.8-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch b/media-libs/mesa/files/21.1.8-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch
new file mode 100644
index 000000000000..ebbb8abb1fe5
--- /dev/null
+++ b/media-libs/mesa/files/21.1.8-util-fossilize_db-Don-t-corrupt-keys-during-entry-re.patch
@@ -0,0 +1,46 @@
+From 8de60a1654a875d0b55512a1508f541f706f9b97 Mon Sep 17 00:00:00 2001
+From: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
+Date: Sat, 4 Sep 2021 03:32:21 +0200
+Subject: [PATCH] util/fossilize_db: Don't corrupt keys during entry read.
+
+We change the hash that is still used to set entry->key.
+
+Fixes: d2d642cc014 "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>
+---
+ src/util/fossilize_db.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c
+index e1709a1ff64..26024101b83 100644
+--- a/src/util/fossilize_db.c
++++ b/src/util/fossilize_db.c
+@@ -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);
+--
+2.32.0
+