{"record":{"id":"4a8f0a1d727052ea","repo":"peass-ng/PEASS-ng","slug":"input-vector-too-large","errorCode":null,"errorMessage":"input vector too large","messagePattern":"input vector too large","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerExternal.cs","lineNumber":44,"sourceCode":"\t\t\t\tdirectReference = (DerObjectIdentifier)enc;\n\t\t\t\toffset++;\n\t\t\t\tenc = GetObjFromVector(vector, offset);\n\t\t\t}\n\t\t\tif (enc is DerInteger)\n\t\t\t{\n\t\t\t\tindirectReference = (DerInteger)enc;\n\t\t\t\toffset++;\n\t\t\t\tenc = GetObjFromVector(vector, offset);\n\t\t\t}\n\t\t\tif (!(enc is Asn1TaggedObject))\n\t\t\t{\n\t\t\t\tdataValueDescriptor = enc;\n\t\t\t\toffset++;\n\t\t\t\tenc = GetObjFromVector(vector, offset);\n\t\t\t}\n\n\t\t\tif (vector.Count != offset + 1)\n\t\t\t\tthrow new ArgumentException(\"input vector too large\", \"vector\");\n\n\t\t\tif (!(enc is Asn1TaggedObject))\n\t\t\t\tthrow new ArgumentException(\"No tagged object found in vector. Structure doesn't seem to be of type External\", \"vector\");\n\n\t\t\tAsn1TaggedObject obj = (Asn1TaggedObject)enc;\n\n\t\t\t// Use property accessor to include check on value\n\t\t\tEncoding = obj.TagNo;\n\n\t\t\tif (encoding < 0 || encoding > 2)\n\t\t\t\tthrow new InvalidOperationException(\"invalid encoding value\");\n\n\t\t\texternalContent = obj.GetObject();\n\t\t}\n\n\t\t/**\n\t\t* Creates a new instance of DerExternal\n\t\t* See X.690 for more informations about the meaning of these parameters","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerExternal.cs#L26-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nvar ext = new DerExternal(vector, 0);\n// after\nif (vector.Count > 1)\n    throw new FormatException(\"Vector has extra elements for External\");\nvar ext = new DerExternal(vector, 0);","handlingStrategy":"validation","validationCode":"if (vector != null && vector.Count == offset + 1)\n{ var ext = new DerExternal(vector, offset); }","typeGuard":null,"tryCatchPattern":"try { var ext = new DerExternal(vector, offset); }\ncatch (ArgumentException ex) when (ex.Message == \"input vector too large\") { /* malformed */ }","preventionTips":["Validate vector length before constructing","Reject malformed BER early at parse time"],"tags":["asn1","bouncycastle","der-encoding","argument-validation"],"backgroundTag":"invalid-asn1-encoding","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}