summaryrefslogtreecommitdiff
path: root/app-arch/fastjar
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/fastjar')
-rw-r--r--app-arch/fastjar/Manifest5
-rw-r--r--app-arch/fastjar/fastjar-0.98-r2.ebuild24
-rw-r--r--app-arch/fastjar/fastjar-0.98-r3.ebuild24
-rw-r--r--app-arch/fastjar/files/0.98-traversal.patch112
-rw-r--r--app-arch/fastjar/metadata.xml13
5 files changed, 178 insertions, 0 deletions
diff --git a/app-arch/fastjar/Manifest b/app-arch/fastjar/Manifest
new file mode 100644
index 000000000000..3f484056b0d2
--- /dev/null
+++ b/app-arch/fastjar/Manifest
@@ -0,0 +1,5 @@
+AUX 0.98-traversal.patch 3010 BLAKE2B 76450d561450aa9c7d5386f53328c0037d6ce9df2d6aac79deb1e47cee7651723cf2863a0d27cb6431a58525a9d0d3c554820b4f22a3099d1fe43b2ea7bec0d1 SHA512 7bfcfebd681f9556e8231786da3326d12ee7ab071e2cadf9a4c17ba4e4e750aeb7e3d7cd78634c36e05179df4a369aae2e04a22533d1954668ada95f1d53d311
+DIST fastjar-0.98.tar.gz 717984 BLAKE2B 1715f1917076799fc58c6c6cea8fb53fc3261a694fa2392c0dc6e30101a7d42de0c5c55cd593627b4d2d0ffa45e3d44ef220c9579caec669721c6b1b9996e43c SHA512 c0f9fca7b58d6acd00b90a5184dbde9ba3ffc5bf4d69512743e450649a272baf1f6af98b15d79d2b53990eaf84ef402c986035e6b615a19e35ed424348143903
+EBUILD fastjar-0.98-r2.ebuild 518 BLAKE2B 97f7913052525beaad3e399f9a267ad28e5501994c2820a28d0e7e592a4c57f208e4acdb8097a031099b8d6f81052c417938aa9267ac517dc0840b06e01b8da4 SHA512 7ef3b44fc6a5384666c9d5b36f38dc2f2c128b7d57f968f16f6c5d6f332ed4f9d80e98a946b4a9120993d5e89996c5e875a5d9d5cf44ed56434d896fab3693ce
+EBUILD fastjar-0.98-r3.ebuild 522 BLAKE2B 52693d318316be2939b7d4ab00c6b1b41bc5cf859c43a98d8162774cd234e4706d3637b08b517277759a90f149ba2aa5d23e651f6c93cf318705c2bb95ac3ab5 SHA512 4026aea676b408699769ade56ce8a107199429afc8d68b3de6b5d60b8552b57ca8f1098223c9f71e99bc5b66aa4a1e86859cf89518b00c3e4feb9210c5fdfc2a
+MISC metadata.xml 478 BLAKE2B 91d7ee00197567dc201739072627c34a8a7073a28b89c5761793ce628d1f62432d91b36b13a65fb95f821101249697a041af339823bb26fe132873c4a20a7b54 SHA512 3b1f8a2998d8496947b8e6c60698db4311ca1afe7ddcd0fe9d4f7ae762acf4204a87f8ebcb9e0b0677727eb82fdda22a299cf3cafcdf83bd348d98ba16ff4214
diff --git a/app-arch/fastjar/fastjar-0.98-r2.ebuild b/app-arch/fastjar/fastjar-0.98-r2.ebuild
new file mode 100644
index 000000000000..37599ed0d5ba
--- /dev/null
+++ b/app-arch/fastjar/fastjar-0.98-r2.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=4
+
+inherit eutils
+
+DESCRIPTION="A jar program written in C"
+HOMEPAGE="https://savannah.nongnu.org/projects/fastjar"
+SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ppc64 x86 ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris"
+
+IUSE=""
+
+# bug #188542
+RDEPEND="!<=dev-java/kaffe-1.1.7-r5"
+
+src_prepare() {
+ # bug #325557
+ epatch "${FILESDIR}/0.98-traversal.patch"
+}
diff --git a/app-arch/fastjar/fastjar-0.98-r3.ebuild b/app-arch/fastjar/fastjar-0.98-r3.ebuild
new file mode 100644
index 000000000000..2b71543f2a0d
--- /dev/null
+++ b/app-arch/fastjar/fastjar-0.98-r3.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="A jar program written in C"
+HOMEPAGE="https://savannah.nongnu.org/projects/fastjar"
+SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris"
+
+IUSE=""
+
+# bug #188542
+RDEPEND="!<=dev-java/kaffe-1.1.7-r5"
+
+src_prepare() {
+ # bug #325557
+ epatch "${FILESDIR}/0.98-traversal.patch"
+}
diff --git a/app-arch/fastjar/files/0.98-traversal.patch b/app-arch/fastjar/files/0.98-traversal.patch
new file mode 100644
index 000000000000..511f4c6cd838
--- /dev/null
+++ b/app-arch/fastjar/files/0.98-traversal.patch
@@ -0,0 +1,112 @@
+--- fastjar-0.98.orig/jartool.c
++++ fastjar-0.98/jartool.c
+@@ -790,6 +790,7 @@
+ progname, jarfile);
+ return 1;
+ }
++ ze->filename[len] = '\0';
+ len = UNPACK_UB4(header, CEN_EFLEN);
+ len += UNPACK_UB4(header, CEN_COMLEN);
+ if (lseek (fd, len, SEEK_CUR) == -1)
+@@ -1257,7 +1258,7 @@
+ exit_on_error("write");
+
+ /* write the file name to the zip file */
+- if (1 == write(jfd, fname, file_name_length))
++ if (-1 == write(jfd, fname, file_name_length))
+ exit_on_error("write");
+
+ if(verbose){
+@@ -1730,7 +1731,17 @@
+ struct stat sbuf;
+ int depth = 0;
+
+- tmp_buff = malloc(sizeof(char) * strlen((const char *)filename));
++ if(*filename == '/'){
++ fprintf(stderr, "Absolute path names are not allowed.\n");
++ exit(EXIT_FAILURE);
++ }
++
++ tmp_buff = malloc(strlen((const char *)filename));
++
++ if(tmp_buff == NULL) {
++ fprintf(stderr, "Out of memory.\n");
++ exit(EXIT_FAILURE);
++ }
+
+ for(;;){
+ const ub1 *idx = (const unsigned char *)strchr((const char *)start, '/');
+@@ -1738,25 +1749,28 @@
+ if(idx == NULL)
+ break;
+ else if(idx == start){
++ tmp_buff[idx - filename] = '/';
+ start++;
+ continue;
+ }
+- start = idx + 1;
+
+- strncpy(tmp_buff, (const char *)filename, (idx - filename));
+- tmp_buff[(idx - filename)] = '\0';
++ memcpy(tmp_buff + (start - filename), (const char *)start, (idx - start));
++ tmp_buff[idx - filename] = '\0';
+
+ #ifdef DEBUG
+ printf("checking the existance of %s\n", tmp_buff);
+ #endif
+- if(strcmp(tmp_buff, "..") == 0){
++ if(idx - start == 2 && memcmp(start, "..", 2) == 0){
+ --depth;
+ if (depth < 0){
+ fprintf(stderr, "Traversal to parent directories during unpacking!\n");
+ exit(EXIT_FAILURE);
+ }
+- } else if (strcmp(tmp_buff, ".") != 0)
++ } else if (idx - start != 1 || *start != '.')
+ ++depth;
++
++ start = idx + 1;
++
+ if(stat(tmp_buff, &sbuf) < 0){
+ if(errno != ENOENT)
+ exit_on_error("stat");
+@@ -1765,6 +1779,7 @@
+ #ifdef DEBUG
+ printf("Directory exists\n");
+ #endif
++ tmp_buff[idx - filename] = '/';
+ continue;
+ }else {
+ fprintf(stderr, "Hmmm.. %s exists but isn't a directory!\n",
+@@ -1781,10 +1796,11 @@
+ if(verbose && handle)
+ printf("%10s: %s/\n", "created", tmp_buff);
+
++ tmp_buff[idx - filename] = '/';
+ }
+
+ /* only a directory */
+- if(strlen((const char *)start) == 0)
++ if(*start == '\0')
+ dir = TRUE;
+
+ #ifdef DEBUG
+@@ -1792,7 +1808,7 @@
+ #endif
+
+ /* If the entry was just a directory, don't write to file, etc */
+- if(strlen((const char *)start) == 0)
++ if(*start == '\0')
+ f_fd = -1;
+
+ free(tmp_buff);
+@@ -1876,7 +1892,8 @@
+ exit(EXIT_FAILURE);
+ }
+
+- close(f_fd);
++ if (f_fd != -1)
++ close(f_fd);
+
+ if(verbose && dir == FALSE && handle)
+ printf("%10s: %s\n",
diff --git a/app-arch/fastjar/metadata.xml b/app-arch/fastjar/metadata.xml
new file mode 100644
index 000000000000..0d201b2da538
--- /dev/null
+++ b/app-arch/fastjar/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>java@gentoo.org</email>
+ <name>Java</name>
+ </maintainer>
+ <longdescription lang="en">
+ Fastjar is a version of Sun's 'jar' utility, written entirely in C,
+ and therefore quite a bit faster. Fastjar can be up to 100x faster
+ than the stock 'jar' program running without a JIT.
+ </longdescription>
+</pkgmetadata>