Share

Solinger Java Utilities Project

Tracker: Bugs

5 find method in Packer.java does not find all words - ID: 1220213
Last Update: Tracker Item Submitted ( koltan )

In the find method of Packer.java the break statement
occurs too early; because of this, the last word in a
block may not be found. This may lead to easy passwords
being erroneously recognised as safe.

The correct for-loop in find has to look like this:

for (;;) {
int middle = lwm + ((hwm - lwm + 1) / 2);

int cmp = s.compareTo(get(middle));
if ( cmp == 0 )
return middle;

if ( hwm == middle ) break;

if (cmp < 0) {
hwm = middle;
} else {
lwm = middle;
}
}


Michael Koltan ( koltan ) - 2005-06-14 09:14

5

Open

None

Nobody/Anonymous

None

None

Public


Comments




Log in to comment.

No follow-up comments have been posted.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.