Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      ByteArrayDataInput has a byte[] ctor, but it doesn't actually work (some things like readVint will work, others will fail due to asserts).

      The problem is it doesnt set things like limit in the ctor... I think the ctor should call reset()
      Most code using this passes null to the ctor to initialize it, then uses reset(), instead they could just call ByteArrayInput(BytesRef.EMPTY_BYTES) if they want to do that.
      finally, reset()'s limit looks like it should be offset + len

      1. LUCENE-3224.patch
        8 kB
        Michael McCandless

        Activity

        Hide
        Robert Muir added a comment -

        also i think we want to assert all bounds checks in here, maybe have a checkBounds(int limit) called only from assert that throws "read past EOF".

        this way we don't rely upon AIOOBE, we could be reading from slices and miss bugs in tests.

        Show
        Robert Muir added a comment - also i think we want to assert all bounds checks in here, maybe have a checkBounds(int limit) called only from assert that throws "read past EOF". this way we don't rely upon AIOOBE, we could be reading from slices and miss bugs in tests.
        Hide
        Michael McCandless added a comment -

        Patch.

        Show
        Michael McCandless added a comment - Patch.
        Hide
        Robert Muir added a comment -

        +1

        Show
        Robert Muir added a comment - +1

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development