-
Bug
-
Resolution: Fixed
-
P4
-
1.0, 5.0
-
b04
-
generic
-
generic
-
Verified
The following code, JarFile.getManifest(), throw IOException: invalid header field
when the manifest contains header name with 70 bytes.
JAR Manifest specification state:"
Because header names cannot be continued, the maximum length of a header name is 70 bytes (there must be a colon and a SPACE after the name)."
getManifest() should not throw IOException at 70 bytes header name (current, it handle up to 69 bytes.)
import java.io.*;
import java.util.*;
import java.util.jar.*;
public class ManifestTest {
public static void main(String args[])
{
if (args.length != 1) {
System.err.println("usage: manif file.jar");
System.exit(1);
}
try {
JarFile jf = new JarFile(args[0]);
Manifest manif = jf.getManifest();
/*
if (manif != null) {
manif.write(System.out);
Attributes attr =
manif.getMainAttributes();
String attrname =
"Specification-Version";
String str =
attr.getValue(attrname);
System.out.println(str);
}
*/
}
catch (IOException e) {
System.err.println(e);
}
}
}
when the manifest contains header name with 70 bytes.
JAR Manifest specification state:"
Because header names cannot be continued, the maximum length of a header name is 70 bytes (there must be a colon and a SPACE after the name)."
getManifest() should not throw IOException at 70 bytes header name (current, it handle up to 69 bytes.)
import java.io.*;
import java.util.*;
import java.util.jar.*;
public class ManifestTest {
public static void main(String args[])
{
if (args.length != 1) {
System.err.println("usage: manif file.jar");
System.exit(1);
}
try {
JarFile jf = new JarFile(args[0]);
Manifest manif = jf.getManifest();
/*
if (manif != null) {
manif.write(System.out);
Attributes attr =
manif.getMainAttributes();
String attrname =
"Specification-Version";
String str =
attr.getValue(attrname);
System.out.println(str);
}
*/
}
catch (IOException e) {
System.err.println(e);
}
}
}
- relates to
-
JDK-8217375 jarsigner breaks old signature with long lines in manifest
-
- Resolved
-
-
JDK-4842483 72-byte line length limit when reading manifest files should be removed
-
- Open
-