equal
deleted
inserted
replaced
470 int numEntries = stream.readUnsignedShort(); |
470 int numEntries = stream.readUnsignedShort(); |
471 for (int i = 0; i < numEntries; i++) { |
471 for (int i = 0; i < numEntries; i++) { |
472 // Read tag number, value type, and value count. |
472 // Read tag number, value type, and value count. |
473 int tagNumber = stream.readUnsignedShort(); |
473 int tagNumber = stream.readUnsignedShort(); |
474 int type = stream.readUnsignedShort(); |
474 int type = stream.readUnsignedShort(); |
|
475 int sizeOfType; |
|
476 try { |
|
477 sizeOfType = TIFFTag.getSizeOfType(type); |
|
478 } catch (IllegalArgumentException e) { |
|
479 throw new IIOException("Illegal type " + type |
|
480 + " for tag number " + tagNumber, e); |
|
481 } |
475 int count = (int)stream.readUnsignedInt(); |
482 int count = (int)stream.readUnsignedInt(); |
476 |
483 |
477 // Get the associated TIFFTag. |
484 // Get the associated TIFFTag. |
478 TIFFTag tag = getTag(tagNumber, tagSetList); |
485 TIFFTag tag = getTag(tagNumber, tagSetList); |
479 |
486 |
508 count = (int)(MAX_ASCII_SIZE/asciiSize); |
515 count = (int)(MAX_ASCII_SIZE/asciiSize); |
509 } |
516 } |
510 } |
517 } |
511 } |
518 } |
512 |
519 |
513 int size = count*TIFFTag.getSizeOfType(type); |
520 int size = count*sizeOfType; |
514 if (size > 4 || tag.isIFDPointer()) { |
521 if (size > 4 || tag.isIFDPointer()) { |
515 // The IFD entry value is a pointer to the actual field value. |
522 // The IFD entry value is a pointer to the actual field value. |
516 long offset = stream.readUnsignedInt(); |
523 long offset = stream.readUnsignedInt(); |
517 |
524 |
518 // Check whether the the field value is within the stream. |
525 // Check whether the the field value is within the stream. |