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 2012/06/10 14:23:42 UTC
[jira] [Created] (LUCENE-4127) negative offsets/deltas corrumption
Robert Muir created LUCENE-4127:
-----------------------------------
Summary: negative offsets/deltas corrumption
Key: LUCENE-4127
URL: https://issues.apache.org/jira/browse/LUCENE-4127
Project: Lucene - Java
Issue Type: Bug
Components: core/index
Affects Versions: 4.0
Reporter: Robert Muir
Attachments: LUCENE-4127_test.patch
If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
See issues such as LUCENE-3920 and some discussion on LUCENE-3738
The question is how to fix this, e.g. should we:
# start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
# leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas
corrumption
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13292510#comment-13292510 ]
Robert Muir commented on LUCENE-4127:
-------------------------------------
just my opinion, I tend towards #1 here. I think offsets should be strongly typed (they are the character offsets),
and we should enforce this so that highlighting actually works.
if people want a place to dump opaque data per-position, they can just use the payload for that.
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas
corrumption
Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13292513#comment-13292513 ]
Michael McCandless commented on LUCENE-4127:
--------------------------------------------
+1 to strongly type offsets.
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas corrumption
Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael McCandless updated LUCENE-4127:
---------------------------------------
Attachment: LUCENE-4127.patch
I think we should also strongly check posIncr coming into IndexWriter ... attached patch does that and fixes a couple tests that were sending posInc=0 for first token.
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127.patch, LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas corrumption
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-4127:
--------------------------------
Attachment: LUCENE-4127_offsetAtt.patch
Here's a patch adding the stateless checks to OffsetAttributeImpl. I think its a good step, and tests pass.
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127.patch, LUCENE-4127_offsetAtt.patch, LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas corrumption
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-4127:
--------------------------------
Attachment: LUCENE-4127.patch
Here's a patch: I think its committable (e.g. so we can get alpha release out).
As a followup I think we should enable the docinverter check when termVectorOffsets are enabled, enable the backwards-offsets check in BaseTokenStreamTestCase, fix the broken analyzers, and improve the tests some more.
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127.patch, LUCENE-4127.patch, LUCENE-4127_offsetAtt.patch, LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas
corrumption
Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13292543#comment-13292543 ]
Michael McCandless commented on LUCENE-4127:
--------------------------------------------
+1
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127.patch, LUCENE-4127.patch, LUCENE-4127_offsetAtt.patch, LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas corrumption
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-4127:
--------------------------------
Attachment: LUCENE-4127_test.patch
Here are some dead-simple tests.
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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-4127) negative offsets/deltas
corrumption
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13292528#comment-13292528 ]
Robert Muir commented on LUCENE-4127:
-------------------------------------
+1! i feel like we should be able to eventually refactor/cleanup docinverter after this (with the silly correction removed),
but I think this should happen under another issue!
> negative offsets/deltas corrumption
> -----------------------------------
>
> Key: LUCENE-4127
> URL: https://issues.apache.org/jira/browse/LUCENE-4127
> Project: Lucene - Java
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0
> Reporter: Robert Muir
> Attachments: LUCENE-4127.patch, LUCENE-4127_test.patch
>
>
> If offsets go negative or backwards, it can corrupt the index with DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS: the offsets will have wrong values (different from the term vectors) or even crazy values like -2147483645
> The problem with this is that its not just theoretical: its too easy to do this with lucene's own analyzer chains (e.g. ngramtokenizer).
>
> See issues such as LUCENE-3920 and some discussion on LUCENE-3738
> The question is how to fix this, e.g. should we:
> # start enforcing that offsets cannot be crazy values in OffsetAttributeImpl/IndexWriter and fix the broken analyzers
> # leave offsets as a pair of opaque integers, declaring this a limitation of the current codec, and either workaround or throw UOE from the postings writer.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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