mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-01 00:00:02 -04:00
#294 Fixed regression, reading JPEGs containing strange APPn markers without identifier string
This commit is contained in:
+2
-3
@@ -29,7 +29,6 @@
|
||||
package com.twelvemonkeys.imageio.plugins.jpeg;
|
||||
|
||||
import com.twelvemonkeys.imageio.metadata.jpeg.JPEG;
|
||||
import com.twelvemonkeys.lang.Validate;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInput;
|
||||
@@ -48,10 +47,10 @@ class Application extends Segment {
|
||||
final String identifier;
|
||||
final byte[] data;
|
||||
|
||||
Application(int marker, final String identifier, final byte[] data) {
|
||||
Application(final int marker, final String identifier, final byte[] data) {
|
||||
super(marker);
|
||||
|
||||
this.identifier = Validate.notEmpty(identifier, "identifier");
|
||||
this.identifier = identifier; // NOTE: Some JPEGs contain APP segments without NULL-terminated identifier
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -723,7 +723,7 @@ public final class JPEGImageReader extends ImageReaderBase {
|
||||
catch (IOException e) {
|
||||
// TODO: Handle bad segments better, for now, just ignore any bad APP markers
|
||||
if (segment.marker() >= JPEG.APP0 && JPEG.APP15 >= segment.marker()) {
|
||||
processWarningOccurred("Bogus " +segment.identifier() + " segment, ignoring");
|
||||
processWarningOccurred("Bogus APP" + (segment.marker() & 0x0f) + "/" + segment.identifier() + " segment, ignoring");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user