You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2011/06/21 18:59:47 UTC

[jira] [Created] (LUCENE-3224) bugs in ByteArrayDataInput

bugs in ByteArrayDataInput
--------------------------

                 Key: LUCENE-3224
                 URL: https://issues.apache.org/jira/browse/LUCENE-3224
             Project: Lucene - Java
          Issue Type: Bug
            Reporter: Robert Muir


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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-3224) bugs in ByteArrayDataInput

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13052679#comment-13052679 ] 

Robert Muir commented on LUCENE-3224:
-------------------------------------

+1

> bugs in ByteArrayDataInput
> --------------------------
>
>                 Key: LUCENE-3224
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3224
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>            Assignee: Michael McCandless
>         Attachments: LUCENE-3224.patch
>
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Updated] (LUCENE-3224) bugs in ByteArrayDataInput

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-3224:
---------------------------------------

    Attachment: LUCENE-3224.patch

Patch.

> bugs in ByteArrayDataInput
> --------------------------
>
>                 Key: LUCENE-3224
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3224
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>            Assignee: Michael McCandless
>         Attachments: LUCENE-3224.patch
>
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Assigned] (LUCENE-3224) bugs in ByteArrayDataInput

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reassigned LUCENE-3224:
------------------------------------------

    Assignee: Michael McCandless

> bugs in ByteArrayDataInput
> --------------------------
>
>                 Key: LUCENE-3224
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3224
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>            Assignee: Michael McCandless
>         Attachments: LUCENE-3224.patch
>
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Resolved] (LUCENE-3224) bugs in ByteArrayDataInput

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-3224.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.0

> bugs in ByteArrayDataInput
> --------------------------
>
>                 Key: LUCENE-3224
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3224
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>            Assignee: Michael McCandless
>             Fix For: 4.0
>
>         Attachments: LUCENE-3224.patch
>
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-3224) bugs in ByteArrayDataInput

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13052660#comment-13052660 ] 

Robert Muir commented on LUCENE-3224:
-------------------------------------

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.


> bugs in ByteArrayDataInput
> --------------------------
>
>                 Key: LUCENE-3224
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3224
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>
> 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

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org