Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Unexpected error during digest computation, Wrong offset or not enough space to store the digest #9

Open
@lauzond

Description

@lauzond

The source code has a copy of org.apache.mina.proxy.utils.MD4.java , but its method

protected int engineDigest(byte[] buf, int offset, int len)

has offset + len > buf.length instead of offset + len >= buf.length (that e.g. mina 2.0.4 has).

If the parent project imports a version of mina that has ">=", a sync from an existing file sometimes (probably for very specific file content or size) yield the following Exception:

java.lang.RuntimeException: Unexpected error during digest computation
at com.salesforce.zsync.internal.Checksum.setChecksum(Checksum.java:86)
at com.salesforce.zsync.internal.DoubleBlockMatcher.tryMatchBoth(DoubleBlockMatcher.java:170)
at com.salesforce.zsync.internal.DoubleBlockMatcher.match(DoubleBlockMatcher.java:99)
at com.salesforce.zsync.Zsync.processInputFile(Zsync.java:449)
at com.salesforce.zsync.Zsync.processInputFiles(Zsync.java:430)
at com.salesforce.zsync.Zsync.zsyncInternal(Zsync.java:361)
at com.salesforce.zsync.Zsync.zsync(Zsync.java:314)
...
Suppressed: com.salesforce.zsync.internal.ChecksumValidationIOException
at com.salesforce.zsync.internal.OutputFileWriter.close(OutputFileWriter.java:213)
at com.salesforce.zsync.Zsync.zsyncInternal(Zsync.java:365)
... 12 more
Caused by: java.security.DigestException: Wrong offset or not enough space to store the digest
at org.apache.mina.proxy.utils.MD4.engineDigest(MD4.java:163)
at java.security.MessageDigest$Delegate.engineDigest(MessageDigest.java:593)
at java.security.MessageDigest.digest(MessageDigest.java:392)
at com.salesforce.zsync.internal.Checksum.setChecksum(Checksum.java:84)
... 17 more

That specific exception was for offset = 0 and len = 16, and buf.length = 16 .
It seems to be pretty much the only .java file of the source code that has a package outside com.salesforce.zsync, we may want to change the package to prevent that problem.

My workaround was to remove the other dependency/import that used Mina.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions