]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
aft: Compare the full hash, not just the first 20 bytes.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 18 May 2025 18:12:24 +0000 (20:12 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 22 May 2025 16:46:48 +0000 (18:46 +0200)
In 0.7.0 the hash algorithm for the hash column of the audio file table
changed from the 20 byte sha1 to the 32 byte sha256. However, the audio file
selector kept calling hash_compare() as the comparator, which looks only at
the first 20 bytes of the buffers passed.

This omission is clearly a bug, but given that we still accept old clients
which only know about sha1, it's benign because the truncated sha256 should
not be worse than sha1. Fix the bug anyway.

Fixes: 126b950f1bd70d1e5c200bc4157bbbb2798fc838
aft.c

diff --git a/aft.c b/aft.c
index b10e7bd174856feb9c74a557e94a902343ab468d..89739356808224ce9158fdc24422df074f19d2c1 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -216,7 +216,7 @@ enum audio_file_table_columns {
 static int aft_hash_compare(const struct osl_object *obj1,
                const struct osl_object *obj2)
 {
-       return hash_compare((unsigned char *)obj1->data,
+       return hash2_compare((unsigned char *)obj1->data,
                (unsigned char *)obj2->data);
 }