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.
This commit is contained in:
parent
f458eaa8f0
commit
90554c1ece
4 changed files with 57 additions and 3 deletions
|
@ -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"
|
.include "Makefile.common"
|
||||||
PKGREVISION= 1
|
PKGREVISION= 2
|
||||||
|
|
||||||
CATEGORIES= devel
|
CATEGORIES= devel
|
||||||
|
|
||||||
|
|
|
@ -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
|
SHA1 (yamcha-0.33.tar.gz) = 4ee6d8150557761f86fcb8af118636b7c23920c0
|
||||||
RMD160 (yamcha-0.33.tar.gz) = ac21fa16a45efa40775d426cd6229f612a7aa21e
|
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-aa) = 16120e3f052a1046ee360bbe449d95dfdb6a3990
|
||||||
SHA1 (patch-configure) = e8ce916348987c5defa16bde2fca4a748ff36a3d
|
SHA1 (patch-configure) = e8ce916348987c5defa16bde2fca4a748ff36a3d
|
||||||
SHA1 (patch-libexec_mkdarts.cpp) = 7fb2dfae8f6b312530f0774f9e8f227b98fdfd5e
|
SHA1 (patch-libexec_mkdarts.cpp) = 7fb2dfae8f6b312530f0774f9e8f227b98fdfd5e
|
||||||
|
SHA1 (patch-libexec_mktrie.cpp) = 4816974718c57819902b4b947a69ffafe82b98a9
|
||||||
|
SHA1 (patch-libexec_pkemine.cpp) = 09fcb52d2b652676b277cb9f148a9d799324bf45
|
||||||
SHA1 (patch-src_param.cpp) = 4fe2da167ce0de0c88153fe545c04efba1b585c7
|
SHA1 (patch-src_param.cpp) = 4fe2da167ce0de0c88153fe545c04efba1b585c7
|
||||||
|
|
36
textproc/yamcha/patches/patch-libexec_mktrie.cpp
Normal file
36
textproc/yamcha/patches/patch-libexec_mktrie.cpp
Normal file
|
@ -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;
|
||||||
|
}
|
16
textproc/yamcha/patches/patch-libexec_pkemine.cpp
Normal file
16
textproc/yamcha/patches/patch-libexec_pkemine.cpp
Normal file
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in a new issue