jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cech. Ulrich" <Ulrich.C...@aeb.de>
Subject SearchIndex-Class, Methode getMaxExtractLength()
Date Tue, 15 Mar 2011 15:12:25 GMT
Hello,

I have a question regarding the following method in the class "SearchIndex". What is the use-case
with the multiplication? 

public int getMaxExtractLength() {
    if (maxExtractLength < 0) {
        return -maxExtractLength * maxFieldLength;
    } else {
        return maxExtractLength;
    }
} 

I think this can be very dangerous, if you set "maxFieldLength" something to Integer.MAX_VALUE,
the multiplication with maxExtractLength can result to an overflow which then results in an
ArrayIndexOutOfBoundsException because the value gets negative.

Thanks in advance,
Ulrich


Mime
View raw message