Changeset 6975


Ignore:
Timestamp:
09/22/10 13:43:30 (9 years ago)
Author:
melissa
Message:

One more set of ArrayIndexOutOfBounds fixes for certain LZW-compressed TIFFs.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/components/bio-formats/src/loci/formats/codec/LZWCodec.java

    r6968 r6975  
    328328            // write string[curr_code] to output 
    329329            // -- but here we are sure that string consists of a single byte 
     330            if (currOutPos >= output.length - 1) break; 
    330331            output[currOutPos++] = newBytes[currCode]; 
    331332            oldCode = currCode; 
     
    356357          int i = currOutPos + outLength; 
    357358          int tablePos = oldCode; 
     359          if (i > output.length) break; 
    358360          while (i > currOutPos) { 
    359361            output[--i] = newBytes[tablePos]; 
     
    362364          currOutPos += outLength; 
    363365          // 2) Write firstByte(string[old_code]) to output 
     366          if (currOutPos >= output.length - 1) break; 
    364367          output[currOutPos++] = output[i]; 
    365368          // 3) Add string[old_code]+firstByte(string[old_code]) to the table 
  • branches/4.2/components/bio-formats/src/loci/formats/codec/LZWCodec.java

    r6968 r6975  
    328328            // write string[curr_code] to output 
    329329            // -- but here we are sure that string consists of a single byte 
     330            if (currOutPos >= output.length - 1) break; 
    330331            output[currOutPos++] = newBytes[currCode]; 
    331332            oldCode = currCode; 
     
    356357          int i = currOutPos + outLength; 
    357358          int tablePos = oldCode; 
     359          if (i > output.length) break; 
    358360          while (i > currOutPos) { 
    359361            output[--i] = newBytes[tablePos]; 
     
    362364          currOutPos += outLength; 
    363365          // 2) Write firstByte(string[old_code]) to output 
     366          if (currOutPos >= output.length - 1) break; 
    364367          output[currOutPos++] = output[i]; 
    365368          // 3) Add string[old_code]+firstByte(string[old_code]) to the table 
  • trunk/components/bio-formats/src/loci/formats/codec/LZWCodec.java

    r6968 r6975  
    328328            // write string[curr_code] to output 
    329329            // -- but here we are sure that string consists of a single byte 
     330            if (currOutPos >= output.length - 1) break; 
    330331            output[currOutPos++] = newBytes[currCode]; 
    331332            oldCode = currCode; 
     
    356357          int i = currOutPos + outLength; 
    357358          int tablePos = oldCode; 
     359          if (i > output.length) break; 
    358360          while (i > currOutPos) { 
    359361            output[--i] = newBytes[tablePos]; 
     
    362364          currOutPos += outLength; 
    363365          // 2) Write firstByte(string[old_code]) to output 
     366          if (currOutPos >= output.length - 1) break; 
    364367          output[currOutPos++] = output[i]; 
    365368          // 3) Add string[old_code]+firstByte(string[old_code]) to the table 
Note: See TracChangeset for help on using the changeset viewer.