org.bouncycastle.asn1.test
Class DefiniteLengthAllocationTest
java.lang.Object
org.bouncycastle.util.test.SimpleTest
org.bouncycastle.asn1.test.DefiniteLengthAllocationTest
- All Implemented Interfaces:
- Test
- public class DefiniteLengthAllocationTest
- extends SimpleTest
Regression coverage for the definite-length materialization allocation guard in
. When wraps a raw
(non-array, non-file) stream, the per-object limit falls back to
(), so allocating the full declared length up front let a short
crafted header - an OCTET STRING declaring a near-heap length with no body - drive an
OutOfMemoryError before any data was read (CWE-789). The buffer is now grown as bytes actually
arrive: a short input allocates only a bounded working buffer, a well-formed object still
materializes correctly, and a truncated object still fails with the established
"DEF length [] object truncated by []" EOFException.
| Methods inherited from class org.bouncycastle.util.test.SimpleTest |
areEqual, areEqual, areEqual, fail, fail, fail, isEquals, isEquals, isEquals, isEquals, isEquals, isEquals, isEquals, isTrue, isTrue, perform, runTest, runTest, runTests, runTests, testException |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefiniteLengthAllocationTest
public DefiniteLengthAllocationTest()
getName
public java.lang.String getName()
- Specified by:
getName in interface Test- Specified by:
getName in class SimpleTest
performTest
public void performTest()
throws java.lang.Exception
- Specified by:
performTest in class SimpleTest
- Throws:
java.lang.Exception
main
public static void main(java.lang.String[] args)