Changeset 6094


Ignore:
Timestamp:
04/06/10 11:10:40 (10 years ago)
Author:
melissa
Message:
  • Prevent Leica reader from reading beyond the end of the file.
  • Fixed a couple of minor bugs in NIOFileHandle.
Location:
trunk/components
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/LeicaReader.java

    r6074 r6094  
    979979      addSeriesMeta("Number of time-markers", numTMs); 
    980980      for (int j=0; j<numTMs; j++) { 
     981        if (in.getFilePointer() + 4 >= in.length()) break; 
    981982        int numDims = in.readInt(); 
    982983 
     
    984985 
    985986        for (int k=0; k<numDims; k++) { 
    986           if (in.getFilePointer() < in.length()) { 
     987          if (in.getFilePointer() + 4 < in.length()) { 
    987988            addSeriesMeta(time + k + " coordinate", in.readInt()); 
    988989          } 
  • trunk/components/common/src/loci/common/NIOFileHandle.java

    r6093 r6094  
    159159  /* @see IRandomAccess.getOrder() */ 
    160160  public ByteOrder getOrder() { 
    161     return buffer.order(); 
     161    return buffer == null ? order : buffer.order(); 
    162162  } 
    163163 
     
    165165  public void setOrder(ByteOrder order) { 
    166166    this.order = order; 
    167     buffer.order(order); 
     167    if (buffer != null) { 
     168      buffer.order(order); 
     169    } 
    168170  } 
    169171 
     
    367369  public void write(ByteBuffer buf, int off, int len) throws IOException { 
    368370    writeSetup(len); 
    369     buf.position(off + len); 
    370371    buf.limit(off + len); 
    371     buf.position(buf.position() - len); 
     372    buf.position(off); 
    372373    position += channel.write(buf, position); 
    373374    buffer = null; 
Note: See TracChangeset for help on using the changeset viewer.