summaryrefslogtreecommitdiff
path: root/textproc
diff options
context:
space:
mode:
authormarino <marino>2012-10-03 14:40:23 +0000
committermarino <marino>2012-10-03 14:40:23 +0000
commita933ef750bab5a7bd2606851cd8f821cdee7df6f (patch)
tree6492781ccd07ef9ebd5a03d3ad7247f9d8b7400e /textproc
parent63956181d046be14ebb03d7905005205eb54dcad (diff)
downloadpkgsrc-a933ef750bab5a7bd2606851cd8f821cdee7df6f.tar.gz
textproc/yamcha: Fix segfault bugs in pkemine + mktrie
The textproc/cabocha package has been failing on i386 DragonFly for months. This was caused by segaults in two utilities provided by yamcha: pkemine and mktrie. Google brought up some pastebin sniplets indicating others had run into the same issue, confirming the fixes. With the revised yamcha utilities, textproc/cabocha builds nicely on DragonFly.
Diffstat (limited to 'textproc')
-rw-r--r--textproc/yamcha/Makefile4
-rw-r--r--textproc/yamcha/distinfo4
-rw-r--r--textproc/yamcha/patches/patch-libexec_mktrie.cpp36
-rw-r--r--textproc/yamcha/patches/patch-libexec_pkemine.cpp16
4 files changed, 57 insertions, 3 deletions
diff --git a/textproc/yamcha/Makefile b/textproc/yamcha/Makefile
index 6f04684e56f..e49c1a127fd 100644
--- a/textproc/yamcha/Makefile
+++ b/textproc/yamcha/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2011/11/18 09:01:27 obache Exp $
+# $NetBSD: Makefile,v 1.4 2012/10/03 14:40:23 marino Exp $
#
.include "Makefile.common"
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= devel
diff --git a/textproc/yamcha/distinfo b/textproc/yamcha/distinfo
index 65c35c27da4..87332b9b1bd 100644
--- a/textproc/yamcha/distinfo
+++ b/textproc/yamcha/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.4 2011/09/14 17:47:38 hans Exp $
+$NetBSD: distinfo,v 1.5 2012/10/03 14:40:23 marino Exp $
SHA1 (yamcha-0.33.tar.gz) = 4ee6d8150557761f86fcb8af118636b7c23920c0
RMD160 (yamcha-0.33.tar.gz) = ac21fa16a45efa40775d426cd6229f612a7aa21e
@@ -6,4 +6,6 @@ Size (yamcha-0.33.tar.gz) = 488670 bytes
SHA1 (patch-aa) = 16120e3f052a1046ee360bbe449d95dfdb6a3990
SHA1 (patch-configure) = e8ce916348987c5defa16bde2fca4a748ff36a3d
SHA1 (patch-libexec_mkdarts.cpp) = 7fb2dfae8f6b312530f0774f9e8f227b98fdfd5e
+SHA1 (patch-libexec_mktrie.cpp) = 4816974718c57819902b4b947a69ffafe82b98a9
+SHA1 (patch-libexec_pkemine.cpp) = 09fcb52d2b652676b277cb9f148a9d799324bf45
SHA1 (patch-src_param.cpp) = 4fe2da167ce0de0c88153fe545c04efba1b585c7
diff --git a/textproc/yamcha/patches/patch-libexec_mktrie.cpp b/textproc/yamcha/patches/patch-libexec_mktrie.cpp
new file mode 100644
index 00000000000..e8d392a7b5c
--- /dev/null
+++ b/textproc/yamcha/patches/patch-libexec_mktrie.cpp
@@ -0,0 +1,36 @@
+$NetBSD: patch-libexec_mktrie.cpp,v 1.1 2012/10/03 14:40:23 marino Exp $
+
+1) Fix segfault bug - bad char cast
+2) There is a duplicate delete; "is" was previously freed already.
+
+--- libexec/mktrie.cpp.orig 2004-09-20 09:59:16.000000000 +0000
++++ libexec/mktrie.cpp
+@@ -111,13 +111,16 @@ int main (int argc, char **argv)
+ column.clear();
+ tokenize<std::string> ((const char*)buf, std::back_inserter(column));
+ if (column.empty()) continue;
+- unsigned int *tmp = new unsigned int [column.size()-1];
+- for (unsigned int i = 0; i < (column.size()-1); i++)
+- tmp[i] = atoi (column[i+1].c_str());
++ string tmp;
++ for (unsigned int i = 0; i < (column.size()-1); i++) {
++ char hexbuf[10]; // assume string(UINT32_MAX).size -> 9
++ snprintf(hexbuf, sizeof(hexbuf), "%09x", atoi (column[i+1].c_str()));
++ tmp = tmp + hexbuf;
++ }
+ feature f;
+- f.f = (unsigned char *)tmp; // cast
++ f.f = (unsigned char *)strdup(tmp.c_str());
+ f.id = atoi (column[0].c_str());
+- f.len = 4*(column.size()-1);
++ f.len = tmp.size();
+ fv.push_back (f);
+ }
+
+@@ -145,6 +148,4 @@ int main (int argc, char **argv)
+ std::cerr << "FATAL: cannot save " << argv[2] << std::endl;
+ return -1;
+ }
+-
+- if (file != "-") delete is;
+ }
diff --git a/textproc/yamcha/patches/patch-libexec_pkemine.cpp b/textproc/yamcha/patches/patch-libexec_pkemine.cpp
new file mode 100644
index 00000000000..d0e06cf9230
--- /dev/null
+++ b/textproc/yamcha/patches/patch-libexec_pkemine.cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-libexec_pkemine.cpp,v 1.1 2012/10/03 14:40:23 marino Exp $
+
+Fix segfault bug - "is" equals std::cin when infile == "-". This delete
+command was intended for allocated std::instream object.
+
+--- libexec/pkemine.cpp.orig 2004-03-12 17:12:13.000000000 +0000
++++ libexec/pkemine.cpp
+@@ -250,7 +250,7 @@ int main (int argc, char **argv)
+ PKEMine pkemine (sigma, minsup, maxpat);
+ pkemine.run (*is, os);
+
+- if (infile == "-") delete is;
++ if (infile != "-") delete is;
+
+ return 0;
+ }