about summary refs log tree commit diff
path: root/tvix/store/src
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-05-08T16·31+0300
committerflokli <flokli@flokli.de>2023-05-10T06·15+0000
commita226a3c2c4a8efc0e8303d2ec243f590bfd4e610 (patch)
treea9db16c5bbdd66572128d4b2074ccec4105eff5a /tvix/store/src
parentb46f2b52c72603071bd9551aaa18b528da4cd380 (diff)
fix(tvix/store/nar/renderer): handle digest error r/6130
Change-Id: I183580732e1dd33ed079a2593097ec790def0a55
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8554
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/store/src')
-rw-r--r--tvix/store/src/nar/renderer.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/tvix/store/src/nar/renderer.rs b/tvix/store/src/nar/renderer.rs
index 335f33643432..a061dad9bb35 100644
--- a/tvix/store/src/nar/renderer.rs
+++ b/tvix/store/src/nar/renderer.rs
@@ -58,8 +58,13 @@ impl<BS: BlobService, CS: ChunkService + Clone, DS: DirectoryService> NARRendere
                     .map_err(RenderError::NARWriterError)?;
             }
             proto::node::Node::File(proto_file_node) => {
-                // get the digest we're referring to
-                let digest = &proto_file_node.digest;
+                let digest: [u8; 32] =
+                    proto_file_node.digest.to_owned().try_into().map_err(|_e| {
+                        RenderError::StoreError(crate::Error::StorageError(
+                            "invalid digest len in file node".to_string(),
+                        ))
+                    })?;
+
                 // query blob_service for blob_meta
                 let resp = self
                     .blob_service
@@ -105,7 +110,6 @@ impl<BS: BlobService, CS: ChunkService + Clone, DS: DirectoryService> NARRendere
                 }
             }
             proto::node::Node::Directory(proto_directory_node) => {
-                // get the digest we're referring to
                 let digest: [u8; 32] =
                     proto_directory_node
                         .digest