From 1a20ac7891f08369da36df82572f12860ec528ce Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 31 Aug 2023 12:31:16 +0200 Subject: [PATCH] rusticl/disk_cache: fix stack corruption The length passed to mesa_bytes_to_hex is the one of the input, not output data. Fixes: fbe9a7ca3e7 ("rusticl/mesa: create proper build-id hash for the disk cache") Signed-off-by: Karol Herbst Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/frontends/rusticl/mesa/util/disk_cache.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gallium/frontends/rusticl/mesa/util/disk_cache.rs b/src/gallium/frontends/rusticl/mesa/util/disk_cache.rs index d07d57ed071..ce272e83d78 100644 --- a/src/gallium/frontends/rusticl/mesa/util/disk_cache.rs +++ b/src/gallium/frontends/rusticl/mesa/util/disk_cache.rs @@ -89,11 +89,7 @@ impl DiskCache { } } SHA1Final(&mut sha, &mut sha_ctx); - mesa_bytes_to_hex( - cache_id.as_mut_ptr(), - sha.as_ptr(), - (cache_id.len() - 1) as u32, - ); + mesa_bytes_to_hex(cache_id.as_mut_ptr(), sha.as_ptr(), sha.len() as u32); disk_cache_create(c_name.as_ptr(), cache_id.as_ptr(), flags) };