{"record":{"id":"92145c5d6742711f","repo":"peass-ng/PEASS-ng","slug":"eof-found-inside-tag-value","errorCode":null,"errorMessage":"EOF found inside tag value.","messagePattern":"EOF found inside tag value\\.","errorType":"exception","errorClass":"EndOfStreamException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1InputStream.cs","lineNumber":265,"sourceCode":"            {\n                tagNo = 0;\n\n                int b = s.ReadByte();\n\n                // X.690-0207 8.1.2.4.2\n                // \"c) bits 7 to 1 of the first subsequent octet shall not all be zero.\"\n                if ((b & 0x7f) == 0) // Note: -1 will pass\n                    throw new IOException(\"corrupted stream - invalid high tag number found\");\n\n                while ((b >= 0) && ((b & 0x80) != 0))\n                {\n                    tagNo |= (b & 0x7f);\n                    tagNo <<= 7;\n                    b = s.ReadByte();\n                }\n\n                if (b < 0)\n                    throw new EndOfStreamException(\"EOF found inside tag value.\");\n\n                tagNo |= (b & 0x7f);\n            }\n\n            return tagNo;\n        }\n\n        internal static int ReadLength(Stream s, int limit, bool isParsing)\n        {\n            int length = s.ReadByte();\n            if (length < 0)\n                throw new EndOfStreamException(\"EOF found when length expected\");\n\n            if (length == 0x80)\n                return -1;      // indefinite-length encoding\n\n            if (length > 127)\n            {","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1InputStream.cs#L247-L283","documentation":"An EndOfStreamException from ReadTagNumber: while accumulating the base-128 continuation octets of a high tag number, ReadByte returned -1 before a terminating octet (high bit clear) was seen. The stream ends in the middle of the multi-octet tag value, indicating truncation.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1InputStream.cs:265 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the complete ASN.1 document is available before parsing (read all bytes, verify expected length)","Check transport framing (TLS records, Base64 padding, file size) for truncation upstream","Handle EndOfStreamException and discard the partial input"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}