peass-ng/PEASS-ng · error · ArgumentException
input vector too large
Error message
input vector too large
What it means
This constructor parses an Asn1EncodableVector representing the fields of a DER External (direct reference, indirect reference, data value descriptor, encoding, content). If after consuming all optional leading fields there are leftover elements beyond the final tagged object, the vector does not match the External structure and ArgumentException is thrown.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerExternal.cs:44
directReference = (DerObjectIdentifier)enc;
offset++;
enc = GetObjFromVector(vector, offset);
}
if (enc is DerInteger)
{
indirectReference = (DerInteger)enc;
offset++;
enc = GetObjFromVector(vector, offset);
}
if (!(enc is Asn1TaggedObject))
{
dataValueDescriptor = enc;
offset++;
enc = GetObjFromVector(vector, offset);
}
if (vector.Count != offset + 1)
throw new ArgumentException("input vector too large", "vector");
if (!(enc is Asn1TaggedObject))
throw new ArgumentException("No tagged object found in vector. Structure doesn't seem to be of type External", "vector");
Asn1TaggedObject obj = (Asn1TaggedObject)enc;
// Use property accessor to include check on value
Encoding = obj.TagNo;
if (encoding < 0 || encoding > 2)
throw new InvalidOperationException("invalid encoding value");
externalContent = obj.GetObject();
}
/**
* Creates a new instance of DerExternal
* See X.690 for more informations about the meaning of these parametersView on GitHub (pinned to 53fb989abc)
Solutions
- Check vector.Count before constructing: it must equal offset + 1 after optional fields; trim or validate the vector
- Re-encode/re-parse the source data — extra objects usually mean malformed input
- Verify the offset argument matches where the External content actually starts in the vector
Example fix
// before
var ext = new DerExternal(vector, 0);
// after
if (vector.Count > 1)
throw new FormatException("Vector has extra elements for External");
var ext = new DerExternal(vector, 0); Defensive patterns
Strategy: validation
Validate before calling
if (vector != null && vector.Count == offset + 1)
{ var ext = new DerExternal(vector, offset); } Try / catch
try { var ext = new DerExternal(vector, offset); }
catch (ArgumentException ex) when (ex.Message == "input vector too large") { /* malformed */ } Prevention
- Validate vector length before constructing
- Reject malformed BER early at parse time
When it happens
Trigger: Calling the DerExternal(Asn1EncodableVector vector, int offset) constructor with a vector containing more elements than the External structure allows at the given offset — i.e. vector.Count > offset + 1 after optional fields are consumed.
Common situations: Decoding corrupt or non-conformant BER data whose EXTERNAL element carries extra objects; passing a general ASN.1 sequence vector to DerExternal by mistake; offset supplied incorrectly so trailing elements remain.
Related errors
- ENUMERATED has zero length
- No tagged object found in vector. Structure doesn't seem to
- too few objects in input vector
- malformed object
- must be in the range 0 to 7
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/4a8f0a1d727052ea.
Report an issue: GitHub.