Changeset 4141


Ignore:
Timestamp:
06/27/08 13:52:01 (12 years ago)
Author:
melissa
Message:

Added checks for invalid note entries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/BioRadReader.java

    r4132 r4141  
    381381    // read notes 
    382382    int noteCount = 0; 
     383    boolean brokenNotes = false; 
    383384    while (notes) { 
    384385      // read in note 
     
    392393      int y = in.readShort(); 
    393394      String text = in.readString(80); 
     395 
     396      if (type < 0 || type >= NOTE_NAMES.length) { 
     397        notes = false; 
     398        brokenNotes = true; 
     399        break; 
     400      } 
    394401 
    395402      // be sure to remove binary data from the note text 
     
    607614    boolean eof = false; 
    608615    int next = 0; 
    609     while (!eof && numLuts < 3) { 
     616    while (!eof && numLuts < 3 && !brokenNotes) { 
    610617      if (in.getFilePointer() + lut[numLuts][next].length <= in.length()) { 
    611618        in.read(lut[numLuts][next++]); 
     
    618625      if (eof && numLuts == 0) lut = null; 
    619626    } 
     627    if (brokenNotes) lut = null; 
    620628 
    621629    if (debug && debugLevel >= 2) { 
Note: See TracChangeset for help on using the changeset viewer.