Index: src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java
===================================================================
--- src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java	(revision 812265)
+++ src/java/org/apache/lucene/analysis/tokenattributes/TermAttributeImpl.java	(working copy)
@@ -194,6 +194,8 @@
       TermAttributeImpl o = ((TermAttributeImpl) other);
       o.initTermBuffer();
       
+	  if (termLength != o.termLength)
+		return false;
       for(int i=0;i<termLength;i++) {
         if (termBuffer[i] != o.termBuffer[i]) {
           return false;

