summaryrefslogtreecommitdiff
path: root/dev-libs/tre/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-03-24 23:59:54 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-03-24 23:59:54 +0000
commit401101f9c8077911929d3f2b60a37098460a5d89 (patch)
treec2bef4719f6787550f0916aeaa8f4f403a9296af /dev-libs/tre/files
parent4cbcc855382a06088e2f016f62cafdbcb7e40665 (diff)
gentoo resync : 25.03.2022
Diffstat (limited to 'dev-libs/tre/files')
-rw-r--r--dev-libs/tre/files/0.8.0-CVE-2016-8559.patch7
-rw-r--r--dev-libs/tre/files/0.8.0-pkgcfg.patch2
-rw-r--r--dev-libs/tre/files/tre-chicken.patch20
-rw-r--r--dev-libs/tre/files/tre-issue37.patch11
-rw-r--r--dev-libs/tre/files/tre-issue50.patch11
-rw-r--r--dev-libs/tre/files/tre-issue55-part1.patch28
-rw-r--r--dev-libs/tre/files/tre-issue55-part2.patch11
-rw-r--r--dev-libs/tre/files/tre-python3.patch191
-rw-r--r--dev-libs/tre/files/tre-tests.patch10
9 files changed, 282 insertions, 9 deletions
diff --git a/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch b/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch
index 39ceae016446..923dbfbf3a2a 100644
--- a/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch
+++ b/dev-libs/tre/files/0.8.0-CVE-2016-8559.patch
@@ -12,13 +12,6 @@ type, size_t, rather than int.
also improve comments, use calloc in place of malloc+memset, and
remove bogus casts.
----
- src/regex/regexec.c | 23 ++++++++++++++++++-----
- 1 file changed, 18 insertions(+), 5 deletions(-)
-
-Note: patch was modified to apply to tre, parts were taken from
-https://github.com/laurikari/tre/issues/37
-
--- a/lib/tre-match-parallel.c
+++ b/lib/tre-match-parallel.c
@@ -59,6 +59,7 @@
diff --git a/dev-libs/tre/files/0.8.0-pkgcfg.patch b/dev-libs/tre/files/0.8.0-pkgcfg.patch
index 82f803504282..7952619c9616 100644
--- a/dev-libs/tre/files/0.8.0-pkgcfg.patch
+++ b/dev-libs/tre/files/0.8.0-pkgcfg.patch
@@ -1,8 +1,6 @@
tre.pc.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
-diff --git a/tre.pc.in b/tre.pc.in
-index fdc45fa..b8d0676 100644
--- a/tre.pc.in
+++ b/tre.pc.in
@@ -6,5 +6,5 @@ includedir=@includedir@
diff --git a/dev-libs/tre/files/tre-chicken.patch b/dev-libs/tre/files/tre-chicken.patch
new file mode 100644
index 000000000000..6047f9ae80d3
--- /dev/null
+++ b/dev-libs/tre/files/tre-chicken.patch
@@ -0,0 +1,20 @@
+--- a/python/setup.py
++++ b/python/setup.py
+@@ -10,7 +10,8 @@ import shutil
+
+ version = "0.8.0"
+ data_files = []
+-include_dirs = ["../lib"]
++include_dirs = ["../include"]
++library_dirs = ["../lib/.libs"]
+ libraries = ["tre"]
+
+ if sys.platform == "win32":
+@@ -31,6 +32,7 @@ setup(name = "tre",
+ sources = ["tre-python.c"],
+ define_macros = [("HAVE_CONFIG_H", None)],
+ include_dirs = include_dirs,
++ library_dirs = library_dirs,
+ libraries = libraries
+ ),
+ ],
diff --git a/dev-libs/tre/files/tre-issue37.patch b/dev-libs/tre/files/tre-issue37.patch
new file mode 100644
index 000000000000..43b0cded7d26
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue37.patch
@@ -0,0 +1,11 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -1480,6 +1480,8 @@ tre_parse(tre_parse_ctx_t *ctx)
+ ctx->re++;
+ while (ctx->re_end - ctx->re >= 0)
+ {
++ if (i == sizeof(tmp))
++ return REG_EBRACE;
+ if (ctx->re[0] == CHAR_RBRACE)
+ break;
+ if (tre_isxdigit(ctx->re[0]))
diff --git a/dev-libs/tre/files/tre-issue50.patch b/dev-libs/tre/files/tre-issue50.patch
new file mode 100644
index 000000000000..f233953ce28f
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue50.patch
@@ -0,0 +1,11 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -1341,7 +1341,7 @@ tre_parse(tre_parse_ctx_t *ctx)
+
+ case CHAR_RPAREN: /* end of current subexpression */
+ if ((ctx->cflags & REG_EXTENDED && depth > 0)
+- || (ctx->re > ctx->re_start
++ || (!(ctx->cflags & REG_EXTENDED) && ctx->re > ctx->re_start
+ && *(ctx->re - 1) == CHAR_BACKSLASH))
+ {
+ DPRINT(("tre_parse: empty: '%.*" STRF "'\n",
diff --git a/dev-libs/tre/files/tre-issue55-part1.patch b/dev-libs/tre/files/tre-issue55-part1.patch
new file mode 100644
index 000000000000..8e12cf683030
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue55-part1.patch
@@ -0,0 +1,28 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -582,16 +582,23 @@
+ tre_parse_int(const tre_char_t **regex, const tre_char_t *regex_end)
+ {
+ int num = -1;
++ int overflow = 0;
+ const tre_char_t *r = *regex;
+ while (r < regex_end && *r >= L'0' && *r <= L'9')
+ {
+ if (num < 0)
+ num = 0;
+- num = num * 10 + *r - L'0';
++ if (num <= (INT_MAX - 9) / 10) {
++ num = num * 10 + *r - L'0';
++ } else {
++ /* This digit could cause an integer overflow. We do not return
++ * directly; instead, consume all remaining digits. */
++ overflow = 1;
++ }
+ r++;
+ }
+ *regex = r;
+- return num;
++ return overflow ? -1 : num;
+ }
+
+
diff --git a/dev-libs/tre/files/tre-issue55-part2.patch b/dev-libs/tre/files/tre-issue55-part2.patch
new file mode 100644
index 000000000000..b28a7a5f4901
--- /dev/null
+++ b/dev-libs/tre/files/tre-issue55-part2.patch
@@ -0,0 +1,11 @@
+--- a/lib/tre-parse.c
++++ b/lib/tre-parse.c
+@@ -641,7 +641,7 @@ tre_parse_bound(tre_parse_ctx_t *ctx, tre_ast_node_t **result)
+ }
+
+ /* Check that the repeat counts are sane. */
+- if ((max >= 0 && min > max) || max > RE_DUP_MAX)
++ if ((max >= 0 && min > max) || max > RE_DUP_MAX || min > RE_DUP_MAX)
+ return REG_BADBR;
+
+
diff --git a/dev-libs/tre/files/tre-python3.patch b/dev-libs/tre/files/tre-python3.patch
new file mode 100644
index 000000000000..b3068519e1dd
--- /dev/null
+++ b/dev-libs/tre/files/tre-python3.patch
@@ -0,0 +1,191 @@
+--- a/python/example.py
++++ b/python/example.py
+@@ -1,7 +1,7 @@
+ import tre
+
+ fz = tre.Fuzzyness(maxerr = 3)
+-print fz
++print (fz)
+
+ pt = tre.compile("Don(ald( Ervin)?)? Knuth", tre.EXTENDED)
+ data = """
+@@ -16,5 +16,5 @@ typefaces.
+ m = pt.search(data, fz)
+
+ if m:
+- print m.groups()
+- print m[0]
++ print (m.groups())
++ print (m[0])
+--- a/python/tre-python.c
++++ b/python/tre-python.c
+@@ -86,9 +86,9 @@ TreFuzzyness_repr(PyObject *obj)
+ TreFuzzynessObject *self = (TreFuzzynessObject*)obj;
+ PyObject *o;
+
+- o = PyString_FromFormat("%s(delcost=%d,inscost=%d,maxcost=%d,subcost=%d,"
++ o = PyUnicode_FromFormat("%s(delcost=%d,inscost=%d,maxcost=%d,subcost=%d,"
+ "maxdel=%d,maxerr=%d,maxins=%d,maxsub=%d)",
+- self->ob_type->tp_name, self->ap.cost_del,
++ Py_TYPE(self)->tp_name, self->ap.cost_del,
+ self->ap.cost_ins, self->ap.max_cost,
+ self->ap.cost_subst, self->ap.max_del,
+ self->ap.max_err, self->ap.max_ins,
+@@ -118,8 +118,7 @@ static PyMemberDef TreFuzzyness_members[
+ };
+
+ static PyTypeObject TreFuzzynessType = {
+- PyObject_HEAD_INIT(NULL)
+- 0, /* ob_size */
++ PyVarObject_HEAD_INIT(NULL, 0)
+ TRE_MODULE ".Fuzzyness", /* tp_name */
+ sizeof(TreFuzzynessObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+@@ -193,7 +192,7 @@ PyTreMatch_groups(TreMatchObject *self,
+ }
+
+ static PyObject *
+-PyTreMatch_groupi(PyObject *obj, int gn)
++PyTreMatch_groupi(PyObject *obj, Py_ssize_t gn)
+ {
+ TreMatchObject *self = (TreMatchObject*)obj;
+ PyObject *result;
+@@ -220,7 +219,7 @@ PyTreMatch_group(TreMatchObject *self, P
+ PyObject *result;
+ long gn;
+
+- gn = PyInt_AsLong(grpno);
++ gn = PyLong_AsLong(grpno);
+
+ if (PyErr_Occurred())
+ return NULL;
+@@ -277,8 +276,7 @@ static PySequenceMethods TreMatch_as_seq
+ };
+
+ static PyTypeObject TreMatchType = {
+- PyObject_HEAD_INIT(NULL)
+- 0, /* ob_size */
++ PyVarObject_HEAD_INIT(NULL, 0)
+ TRE_MODULE ".Match", /* tp_name */
+ sizeof(TreMatchObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+@@ -380,8 +378,8 @@ PyTrePattern_search(TrePatternObject *se
+ }
+ else
+ {
+- targ = PyString_AsString(pstring);
+- tlen = PyString_Size(pstring);
++ targ = PyBytes_AsString(pstring);
++ tlen = PyBytes_Size(pstring);
+
+ rc = tre_reganexec(&self->rgx, targ, tlen, &mo->am, fz->ap, eflags);
+ }
+@@ -433,8 +431,7 @@ PyTrePattern_dealloc(TrePatternObject *s
+ }
+
+ static PyTypeObject TrePatternType = {
+- PyObject_HEAD_INIT(NULL)
+- 0, /* ob_size */
++ PyVarObject_HEAD_INIT(NULL, 0)
+ TRE_MODULE ".Pattern", /* tp_name */
+ sizeof(TrePatternObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+@@ -467,7 +464,7 @@ static PyTypeObject TrePatternType = {
+ };
+
+ static TrePatternObject *
+-newTrePatternObject()
++newTrePatternObject(void)
+ {
+ TrePatternObject *self;
+
+@@ -482,7 +479,7 @@ static PyObject *
+ PyTre_ncompile(PyObject *self, PyObject *args)
+ {
+ TrePatternObject *rv;
+- PyUnicodeObject *upattern = NULL;
++ PyObject *upattern = NULL;
+ char *pattern = NULL;
+ int pattlen;
+ int cflags = 0;
+@@ -537,9 +534,8 @@ static PyMethodDef tre_methods[] = {
+ { NULL, NULL }
+ };
+
+-static char *tre_doc =
+-"Python module for TRE library\n\nModule exports "
+-"the only function: compile";
++
++#define tre_doc "Python module for TRE library\n\nModule exports the only function: compile"
+
+ static struct _tre_flags {
+ char *name;
+@@ -556,40 +552,57 @@ static struct _tre_flags {
+ { NULL, 0 }
+ };
+
++
++static struct PyModuleDef moduledef = {
++ PyModuleDef_HEAD_INIT,
++ TRE_MODULE ".Module", /* m_name */
++ tre_doc, /* m_doc */
++ -1, /* m_size */
++ tre_methods, /* m_methods */
++ NULL, /* m_reload */
++ NULL, /* m_traverse */
++ NULL, /* m_clear */
++ NULL, /* m_free */
++};
++
++
+ PyMODINIT_FUNC
+-inittre(void)
++PyInit_tre(void)
+ {
+ PyObject *m;
+ struct _tre_flags *fp;
+
+ if (PyType_Ready(&TreFuzzynessType) < 0)
+- return;
++ return NULL;
+ if (PyType_Ready(&TreMatchType) < 0)
+- return;
++ return NULL;
+ if (PyType_Ready(&TrePatternType) < 0)
+- return;
++ return NULL;
+
+ /* Create the module and add the functions */
+- m = Py_InitModule3(TRE_MODULE, tre_methods, tre_doc);
++
++ m = PyModule_Create (&moduledef);
++
+ if (m == NULL)
+- return;
++ return NULL;
+
+ Py_INCREF(&TreFuzzynessType);
+ if (PyModule_AddObject(m, "Fuzzyness", (PyObject*)&TreFuzzynessType) < 0)
+- return;
++ return NULL;
+ Py_INCREF(&TreMatchType);
+ if (PyModule_AddObject(m, "Match", (PyObject*)&TreMatchType) < 0)
+- return;
++ return NULL;
+ Py_INCREF(&TrePatternType);
+ if (PyModule_AddObject(m, "Pattern", (PyObject*)&TrePatternType) < 0)
+- return;
++ return NULL;
+ ErrorObject = PyErr_NewException(TRE_MODULE ".Error", NULL, NULL);
+ Py_INCREF(ErrorObject);
+ if (PyModule_AddObject(m, "Error", ErrorObject) < 0)
+- return;
++ return NULL;
+
+ /* Insert the flags */
+ for (fp = tre_flags; fp->name != NULL; fp++)
+ if (PyModule_AddIntConstant(m, fp->name, fp->val) < 0)
+- return;
++ return NULL;
++ return m;
+ }
diff --git a/dev-libs/tre/files/tre-tests.patch b/dev-libs/tre/files/tre-tests.patch
new file mode 100644
index 000000000000..c39ff9fb268d
--- /dev/null
+++ b/dev-libs/tre/files/tre-tests.patch
@@ -0,0 +1,10 @@
+--- tre-0.7.6/tests/agrep/run-tests.sh.tests
++++ tre-0.7.6/tests/agrep/run-tests.sh
+@@ -2,6 +2,7 @@
+
+ set -e
+
++export LD_LIBRARY_PATH=$top_builddir/lib/.libs
+ agrep="$top_builddir/src/agrep"
+
+ echo "$builddir $top_builddir $srcdir"