-
Notifications
You must be signed in to change notification settings - Fork 54
sending an empty directory produces a BLAKE3 hazmat
assertion failure
#87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Trying the same thing on |
This must be related to the fact that you are creating the temp files for sendme in the same dir as where you are. mkdir tmp does not have the issue. But it should not happen. I will take a closer look tomorrow. |
pretty sure it is unrelated to the hazmat changes. very likely a bug on our side. |
Interesting bug. So things get screwed up because we create a database in the send dir, and if this is the current dir, we also try to scan the database itself. So basically we are sending data that is mutated. This can not work. The sender detects that the data is corrupt and stops sending. On the recv side this caused a short read (something that should have a size of x != 0 was read with a size 0. And then we feed this into the hasher, and it panics because hashing a blob of size 0 as a non root hash must be wrong. Before it would just produce a wrong value, leading to validation failing. |
I don't mind the panic. This is obvious misuse of the hasher. We have to fix this on our side! |
Yeah my guess is that this was a pre-existing bug, and the aggressive asserts in the new |
This is exactly it. There was a preexisting bug that led to the exact wanted behaviour - hash did not match, content was rejected at exactly the right offset. So I did not notice it - basically the thing worked as designed, but for the wrong reason. I will fix this today (really needed some downtime over the weekend). I am myself a bit unsure about whether this should be an assert! or debug_assert!. In general I like functions to either return an error or be total, but this is a special case. I would say given the general philosophy of BLAKE3, if doing this wrong has security implications, or if there is even the slightest doubt whether it could have security implications, it should be an |
This is with
sendme--version
0.25.0. In one terminal:In another:
The text was updated successfully, but these errors were encountered: