Class BinaryStubBundleTest

java.lang.Object
org.checkerframework.framework.stub.BinaryStubBundleTest

public class BinaryStubBundleTest extends Object
Tests that a damaged binary stub bundle is reported as a malformed file, not a crash. Mirrors BinaryStubDataTest, which does the same for the per-file format that a bundle's entries are made of; see that class's documentation for why the files here are hand-built rather than produced by BinaryStubFileGenerator and then damaged.

Unlike a per-file binary stub, a bundle's own container is not GZIP-compressed (only each entry's bytes are; see BinaryStubBundle's class documentation), so these bytes are built directly, uncompressed.

  • Constructor Details

    • BinaryStubBundleTest

      public BinaryStubBundleTest()
  • Method Details

    • negativeEntryCountIsMalformed

      public void negativeEntryCountIsMalformed() throws IOException
      A negative entry count must be rejected, not passed to a negative-size allocation.
      Throws:
      IOException
    • hugeEntryCountIsMalformed

      public void hugeEntryCountIsMalformed() throws IOException
      An absurdly large entry count must be rejected, not allocated.
      Throws:
      IOException
    • negativeEntryLengthIsMalformed

      public void negativeEntryLengthIsMalformed() throws IOException
      A negative entry length must be rejected, not passed to new byte[-1].
      Throws:
      IOException
    • hugeEntryLengthIsMalformed

      public void hugeEntryLengthIsMalformed() throws IOException
      An absurdly large entry length must be rejected, not allocated.
      Throws:
      IOException
    • truncatedFileIsMalformed

      public void truncatedFileIsMalformed() throws IOException
      A file that stops in the middle of an entry must be rejected.
      Throws:
      IOException
    • wrongMagicIsMalformed

      public void wrongMagicIsMalformed() throws IOException
      A file that is not a binary stub bundle at all must be rejected.
      Throws:
      IOException
    • wrongVersionIsMalformed

      public void wrongVersionIsMalformed() throws IOException
      A bundle written by a different version of the format must be rejected.
      Throws:
      IOException