peass-ng/PEASS-ng · error · DataLengthException
Output buffer is too short to hold output
Error message
Output buffer is too short to hold output
What it means
Thrown by SkeinEngine's DoFinal when the caller-supplied output buffer is too small: outOff plus the configured output size in bytes exceeds outBytes.Length, so finishing the hash would write past the end of the buffer.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs:744
public void Update(byte inByte)
{
singleByte[0] = inByte;
Update(singleByte, 0, 1);
}
public void Update(byte[] inBytes, int inOff, int len)
{
CheckInitialised();
ubi.Update(inBytes, inOff, len, chain);
}
public int DoFinal(byte[] outBytes, int outOff)
{
CheckInitialised();
if (outBytes.Length < (outOff + outputSizeBytes))
{
throw new DataLengthException("Output buffer is too short to hold output");
}
// Finalise message block
UbiFinal();
// Process additional post-message parameters
if (postMessageParameters != null)
{
for (int i = 0; i < postMessageParameters.Length; i++)
{
Parameter param = postMessageParameters[i];
UbiComplete(param.Type, param.Value);
}
}
// Perform the output transform
int blockSize = BlockSize;
int blocksRequired = ((outputSizeBytes + blockSize - 1) / blockSize);View on GitHub (pinned to 53fb989abc)
Solutions
- Allocate outBytes with at least outOff + engine output size bytes (GetDigestSize())
- Reduce outOff or use a fresh buffer sized for the configured output
- Lower the configured output size in the SkeinEngine constructor/SkeinParameters to match your buffer
Example fix
// before byte[] outBytes = new byte[32]; engine.DoFinal(outBytes, 0); // after byte[] outBytes = new byte[engine.GetDigestSize()]; engine.DoFinal(outBytes, 0);
Defensive patterns
Strategy: validation
Validate before calling
byte[] outBytes = new byte[engine.GetDigestSize() + outOff]; engine.DoFinal(outBytes, outOff);
Type guard
static bool CanHoldDigest(byte[] buf, int off, int digestSize) => buf != null && buf.Length >= off + digestSize;
Try / catch
try { engine.DoFinal(outBytes, outOff); } catch (DataLengthException ex) { /* grow buffer and retry */ } Prevention
- Size output buffers from GetDigestSize(), never hard-code 32
- Reset outOff to 0 for single-shot hashing
- Be aware Skein output size is configurable and may exceed SHA-256 sizes
When it happens
Trigger: Calling DoFinal(outBytes, outOff) where outBytes is shorter than outOff plus the digest size configured for the engine (e.g. a 32-byte buffer for a 64-byte Skein-512 output, or a large outOff).
Common situations: Assuming a SHA-256-sized 32-byte buffer when the Skein state was configured for a larger output size; off-by-one or reused outOff in incremental hashing loops.
Related errors
- msg
- Keys > 32 are not supported
- Invalid digest length (required: 1 - 32)
- Salt length must be exactly 8 bytes
- Personalization length must be exactly 8 bytes
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/58cd333400260336.
Report an issue: GitHub.