Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D99639B7A for ; Tue, 14 Feb 2012 14:16:23 +0000 (UTC) Received: (qmail 22797 invoked by uid 500); 14 Feb 2012 14:16:21 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 22731 invoked by uid 500); 14 Feb 2012 14:16:21 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 22689 invoked by uid 99); 14 Feb 2012 14:16:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2012 14:16:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2012 14:16:20 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id ED4DC1B7A26 for ; Tue, 14 Feb 2012 14:15:59 +0000 (UTC) Date: Tue, 14 Feb 2012 14:15:59 +0000 (UTC) From: "Guangtai Liang (Updated) (JIRA)" To: dev@lucene.apache.org Message-ID: <1199874987.36438.1329228959973.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1009466486.36181.1329223139597.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (LUCENE-3779) An incomplete fix for the NPE bugs in MultipleTermPositions.java MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-3779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Guangtai Liang updated LUCENE-3779: ----------------------------------- Description: The fix revision 219387 (Fix for NPE (bug #35626). Fix by Hans Hjelm, test case by Scotty Allen.) was aimed to remove an NPE bug on the return value of "_termPositionsQueue.peek()" in the method "skipTo" of the file "/lucene/java/trunk/src/java/org/apache/lucene/index/MultipleTermPositions.java" , but it is incomplete. Since the returned value "_termPositionsQueue.peek()" could be null during the run-time execution, its value should also be null-checked before being dereferenced in other methods. The buggy code locations the same fix needs to be applied at are as bellows: Line 118, 124, 135 of the method "next()" : public final boolean next() throws IOException { if (_termPositionsQueue.size() == 0) return false; _posList.clear(); [Line 118] _doc = _termPositionsQueue.peek().doc(); TermPositions tp; do { tp = _termPositionsQueue.peek(); [Line 124] for (int i = 0; i < tp.freq(); i++) { // NOTE: this can result in dup positions being added! _posList.add(tp.nextPosition()); } if (tp.next()) _termPositionsQueue.updateTop(); else { _termPositionsQueue.pop(); tp.close(); } [Line 135] } while (_termPositionsQueue.size() > 0 && _termPositionsQueue.peek().doc() == _doc); _posList.sort(); _freq = _posList.size(); return true; } was: The fix revision 219387 was aimed to remove an NPE bug on the return value of "_termPositionsQueue.peek()" in the method "skipTo" of the file "/lucene/java/trunk/src/java/org/apache/lucene/index/MultipleTermPositions.java" , but it is incomplete. Since the returned value "_termPositionsQueue.peek()" could be null during the run-time execution, its value should also be null-checked before being dereferenced in other methods. The buggy code locations the same fix needs to be applied at are as bellows: Line 118, 124, 135 of the method "next()" : public final boolean next() throws IOException { if (_termPositionsQueue.size() == 0) return false; _posList.clear(); [Line 118] _doc = _termPositionsQueue.peek().doc(); TermPositions tp; do { tp = _termPositionsQueue.peek(); [Line 124] for (int i = 0; i < tp.freq(); i++) { // NOTE: this can result in dup positions being added! _posList.add(tp.nextPosition()); } if (tp.next()) _termPositionsQueue.updateTop(); else { _termPositionsQueue.pop(); tp.close(); } [Line 135] } while (_termPositionsQueue.size() > 0 && _termPositionsQueue.peek().doc() == _doc); _posList.sort(); _freq = _posList.size(); return true; } > An incomplete fix for the NPE bugs in MultipleTermPositions.java > ---------------------------------------------------------------- > > Key: LUCENE-3779 > URL: https://issues.apache.org/jira/browse/LUCENE-3779 > Project: Lucene - Java > Issue Type: Bug > Components: core/index > Affects Versions: 3.0 > Reporter: Guangtai Liang > Priority: Critical > Original Estimate: 10m > Remaining Estimate: 10m > > The fix revision 219387 (Fix for NPE (bug #35626). Fix by Hans Hjelm, test case by Scotty Allen.) was aimed to remove an NPE bug on the return value of "_termPositionsQueue.peek()" in the method "skipTo" of the file "/lucene/java/trunk/src/java/org/apache/lucene/index/MultipleTermPositions.java" , but it is incomplete. > Since the returned value "_termPositionsQueue.peek()" could be null during the run-time execution, its value should also be null-checked before being dereferenced in other methods. > The buggy code locations the same fix needs to be applied at are as bellows: > > Line 118, 124, 135 of the method "next()" : > public final boolean next() throws IOException { > if (_termPositionsQueue.size() == 0) > return false; > _posList.clear(); > [Line 118] _doc = _termPositionsQueue.peek().doc(); > TermPositions tp; > do { > tp = _termPositionsQueue.peek(); > [Line 124] for (int i = 0; i < tp.freq(); i++) { > // NOTE: this can result in dup positions being added! > _posList.add(tp.nextPosition()); > } > if (tp.next()) > _termPositionsQueue.updateTop(); > else { > _termPositionsQueue.pop(); > tp.close(); > } > [Line 135] } while (_termPositionsQueue.size() > 0 && _termPositionsQueue.peek().doc() == _doc); > _posList.sort(); > _freq = _posList.size(); > return true; > } -- 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