-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
17
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
We generated a unit test automatically and it failed with dead cycle.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
@Test
public void test_addCharString_1_1(){
short short1 = 0;
byte byte2 = 0;
com.sun.imageio.plugins.common.LZWStringTable lZWStringTable0 = new com.sun.imageio.plugins.common.LZWStringTable();
lZWStringTable0.addCharString(short1, byte2);
}
ACTUAL -
dead cycle in LZWStringTable.java:88.
The reason is that ' strHsh[i] != HASH_FREE ' is always true.
---------- BEGIN SOURCE ----------
public int addCharString(short index, byte b) {
int hshidx;
if (numStrings >= MAXSTR) { // if used up all codes
return 0xFFFF;
}
hshidx = hash(index, b);
while (strHsh[hshidx] != HASH_FREE) {
hshidx = (hshidx + HASHSTEP) % HASHSIZE;
}
strHsh[hshidx] = numStrings;
strChr[numStrings] = b;
if (index == HASH_FREE) {
strNxt[numStrings] = NEXT_FIRST;
strLen[numStrings] = 1;
} else {
strNxt[numStrings] = index;
strLen[numStrings] = strLen[index] + 1;
}
return numStrings++; // return the code and inc for next code
}
---------- END SOURCE ----------
FREQUENCY : occasionally
We generated a unit test automatically and it failed with dead cycle.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
@Test
public void test_addCharString_1_1(){
short short1 = 0;
byte byte2 = 0;
com.sun.imageio.plugins.common.LZWStringTable lZWStringTable0 = new com.sun.imageio.plugins.common.LZWStringTable();
lZWStringTable0.addCharString(short1, byte2);
}
ACTUAL -
dead cycle in LZWStringTable.java:88.
The reason is that ' strHsh[i] != HASH_FREE ' is always true.
---------- BEGIN SOURCE ----------
public int addCharString(short index, byte b) {
int hshidx;
if (numStrings >= MAXSTR) { // if used up all codes
return 0xFFFF;
}
hshidx = hash(index, b);
while (strHsh[hshidx] != HASH_FREE) {
hshidx = (hshidx + HASHSTEP) % HASHSIZE;
}
strHsh[hshidx] = numStrings;
strChr[numStrings] = b;
if (index == HASH_FREE) {
strNxt[numStrings] = NEXT_FIRST;
strLen[numStrings] = 1;
} else {
strNxt[numStrings] = index;
strLen[numStrings] = strLen[index] + 1;
}
return numStrings++; // return the code and inc for next code
}
---------- END SOURCE ----------
FREQUENCY : occasionally