A bugfix update to 6.2.6. Tested amd64. OK? Index: Makefile =================================================================== RCS file: /cvs/ports/lang/swi-prolog/Makefile,v retrieving revision 1.48 diff -u -p -r1.48 Makefile --- Makefile 6 May 2013 17:49:37 -0000 1.48 +++ Makefile 3 Jul 2013 09:15:47 -0000 @@ -6,10 +6,9 @@ BROKEN-sparc64 = infinite loop or aborts COMMENT = Prolog for the real world -V = 6.2.2 +V = 6.2.6 DISTNAME = pl-$V PKGNAME = swi-prolog-$V -REVISION = 1 CATEGORIES = lang SHARED_LIBS = pl 4.0 @@ -54,7 +53,7 @@ LIB_DEPENDS = devel/gmp \ graphics/jpeg WANTLIB += ICE SM X11 Xext Xft Xinerama Xpm Xt c crypto execinfo -WANTLIB += expat fontconfig freetype gmp jpeg m ncursesw pthread +WANTLIB += fontconfig gmp jpeg m ncursesw pthread WANTLIB += readline ssl z FULLARCH = ${MACHINE_ARCH:S/amd64/x86_64/}-openbsd${OSREV} @@ -69,6 +68,7 @@ post-install: # The following tests fail (hang). We remove them to allow the rest # of the tests to execute atleast. # When updating, uncomment these to see if they still fail. +# Still failing 20130623 :( pre-test: rm -f ${WRKBUILD}/src/Tests/thread/test_signal.pl rm -f ${WRKBUILD}/src/Tests/core/test_resource_error.pl Index: distinfo =================================================================== RCS file: /cvs/ports/lang/swi-prolog/distinfo,v retrieving revision 1.8 diff -u -p -r1.8 distinfo --- distinfo 1 Oct 2012 21:16:00 -0000 1.8 +++ distinfo 3 Jul 2013 09:15:47 -0000 @@ -1,2 +1,2 @@ -SHA256 (pl-6.2.2.tar.gz) = 4tWmJ1bqAAH2WiQR3+fTgOHSq3s2X+ErxuEQ2Wb+Q90= -SIZE (pl-6.2.2.tar.gz) = 14353692 +SHA256 (pl-6.2.6.tar.gz) = lBLwdTphww288a+sAf58kWgAKFRwngDgnCH5WeEjIUY= +SIZE (pl-6.2.6.tar.gz) = 14407455 Index: patches/patch-src_os_pl-buffer_h =================================================================== RCS file: patches/patch-src_os_pl-buffer_h diff -N patches/patch-src_os_pl-buffer_h --- patches/patch-src_os_pl-buffer_h 8 Jan 2013 13:36:47 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,25 +0,0 @@ -$OpenBSD: patch-src_os_pl-buffer_h,v 1.1 2013/01/08 13:36:47 jasper Exp $ - -From a9a6fc8a2a9cf3b9154b490a4b1ffaa8be4d723c Mon Sep 17 00:00:00 2001 -From: Jan Wielemaker <j.wielema...@cs.vu.nl> -Date: Sun, 16 Dec 2012 18:13:17 +0100 -Subject: [PATCH] FIXED: Possible buffer overrun in patch canonisation code. - -Pushes pointers on an automatic array without checking for overflow. -Can be used for DoS attacks. Will be extremely hard to make it execute -arbitrary code. - -Fixes CVE-2012-6089, patch from upstream: -http://www.swi-prolog.org/git/pl.git/commit/a9a6fc8a2a9cf3b9154b490a4b1ffaa8be4d723c - ---- src/os/pl-buffer.h.orig Thu Sep 27 20:43:34 2012 -+++ src/os/pl-buffer.h Tue Jan 8 14:11:56 2013 -@@ -101,6 +101,8 @@ f__allocFromBuffer(Buffer b, size_t bytes) - sizeof((b)->static_buffer)) - #define emptyBuffer(b) ((b)->top = (b)->base) - #define isEmptyBuffer(b) ((b)->top == (b)->base) -+#define popBuffer(b,type) \ -+ ((b)->top -= sizeof(type), *(type*)(b)->top) - - #define discardBuffer(b) \ - do \ Index: patches/patch-src_os_pl-glob_c =================================================================== RCS file: patches/patch-src_os_pl-glob_c diff -N patches/patch-src_os_pl-glob_c --- patches/patch-src_os_pl-glob_c 8 Jan 2013 13:36:47 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,108 +0,0 @@ -$OpenBSD: patch-src_os_pl-glob_c,v 1.1 2013/01/08 13:36:47 jasper Exp $ - -From b2c88972e7515ada025e97e7d3ce3e34f81cf33e Mon Sep 17 00:00:00 2001 -From: Jan Wielemaker <j.wielema...@cs.vu.nl> -Date: Sun, 16 Dec 2012 17:29:37 +0100 -Subject: [PATCH] SECURITY: Possible buffer overflows when expanding file-names with long - paths. Affects expand_file_name/2. - - Can lead to crashes (DoS attacks) and possibly execution of arbitrary - code if an attacker can control the names of the files searched for, - e.g., if expand_file_name/2 is used in a directory to which an attacker - can upload files for which he can control the name. - -Fixes CVE-2012-6090, patch from upstream: -http://www.swi-prolog.org/git/pl.git/commitdiff/b2c88972e7515ada025e97e7d3ce3e34f81cf33e - ---- src/os/pl-glob.c.orig Thu Sep 27 20:43:34 2012 -+++ src/os/pl-glob.c Tue Jan 8 14:13:33 2013 -@@ -424,6 +424,7 @@ expand(const char *pattern, GlobInfo info) - compiled_pattern cbuf; - char prefix[MAXPATHLEN]; /* before first pattern */ - char patbuf[MAXPATHLEN]; /* pattern buffer */ -+ size_t prefix_len; - int end, dot; - - initBuffer(&info->files); -@@ -442,20 +443,25 @@ expand(const char *pattern, GlobInfo info) - switch( (c=*s++) ) - { case EOS: - if ( s > pat ) /* something left and expanded */ -- { un_escape(prefix, pat, s); -+ { size_t prefix_len; - -+ un_escape(prefix, pat, s); -+ prefix_len = strlen(prefix); -+ - end = info->end; - for( ; info->start < end; info->start++ ) - { char path[MAXPATHLEN]; -- size_t plen; -+ const char *entry = expand_entry(info, info->start); -+ size_t plen = strlen(entry); - -- strcpy(path, expand_entry(info, info->start)); -- plen = strlen(path); -- if ( prefix[0] && plen > 0 && path[plen-1] != '/' ) -- path[plen++] = '/'; -- strcpy(&path[plen], prefix); -- if ( end == 1 || AccessFile(path, ACCESS_EXIST) ) -- add_path(path, info); -+ if ( plen+prefix_len+2 <= MAXPATHLEN ) -+ { strcpy(path, entry); -+ if ( prefix[0] && plen > 0 && path[plen-1] != '/' ) -+ path[plen++] = '/'; -+ strcpy(&path[plen], prefix); -+ if ( end == 1 || AccessFile(path, ACCESS_EXIST) ) -+ add_path(path, info); -+ } - } - } - succeed; -@@ -490,8 +496,9 @@ expand(const char *pattern, GlobInfo info) - */ - un_escape(prefix, pat, head); - un_escape(patbuf, head, tail); -+ prefix_len = strlen(prefix); - -- if ( !compilePattern(patbuf, &cbuf) ) /* syntax error */ -+ if ( !compilePattern(patbuf, &cbuf) ) /* syntax error */ - fail; - dot = (patbuf[0] == '.'); /* do dots as well */ - -@@ -503,12 +510,16 @@ expand(const char *pattern, GlobInfo info) - char path[MAXPATHLEN]; - char tmp[MAXPATHLEN]; - const char *current = expand_entry(info, info->start); -+ size_t clen = strlen(current); - -+ if ( clen+prefix_len+1 > sizeof(path) ) -+ continue; -+ - strcpy(path, current); -- strcat(path, prefix); -+ strcpy(&path[clen], prefix); - - if ( (d=opendir(path[0] ? OsPath(path, tmp) : ".")) ) -- { size_t plen = strlen(path); -+ { size_t plen = clen+prefix_len; - - if ( plen > 0 && path[plen-1] != '/' ) - path[plen++] = '/'; -@@ -522,12 +533,11 @@ expand(const char *pattern, GlobInfo info) - matchPattern(e->d_name, &cbuf) ) - { char newp[MAXPATHLEN]; - -- strcpy(newp, path); -- strcpy(&newp[plen], e->d_name); --/* if ( !tail[0] || ExistsDirectory(newp) ) -- Saves memory, but involves one more file-access --*/ -+ if ( plen+strlen(e->d_name)+1 < sizeof(newp) ) -+ { strcpy(newp, path); -+ strcpy(&newp[plen], e->d_name); - add_path(newp, info); -+ } - } - } - closedir(d); Index: patches/patch-src_os_pl-os_c =================================================================== RCS file: patches/patch-src_os_pl-os_c diff -N patches/patch-src_os_pl-os_c --- patches/patch-src_os_pl-os_c 8 Jan 2013 13:36:47 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,72 +0,0 @@ -$OpenBSD: patch-src_os_pl-os_c,v 1.1 2013/01/08 13:36:47 jasper Exp $ - -From a9a6fc8a2a9cf3b9154b490a4b1ffaa8be4d723c Mon Sep 17 00:00:00 2001 -From: Jan Wielemaker <j.wielema...@cs.vu.nl> -Date: Sun, 16 Dec 2012 18:13:17 +0100 -Subject: [PATCH] FIXED: Possible buffer overrun in patch canonisation code. - -Pushes pointers on an automatic array without checking for overflow. -Can be used for DoS attacks. Will be extremely hard to make it execute -arbitrary code. - -Fixes CVE-2012-6089, patch from upstream: -http://www.swi-prolog.org/git/pl.git/commit/a9a6fc8a2a9cf3b9154b490a4b1ffaa8be4d723c - ---- src/os/pl-os.c.orig Thu Sep 27 20:43:34 2012 -+++ src/os/pl-os.c Tue Jan 8 14:11:56 2013 -@@ -1057,8 +1057,7 @@ cleanupExpand(void) - char * - canoniseFileName(char *path) - { char *out = path, *in = path, *start = path; -- char *osave[100]; -- int osavep = 0; -+ tmp_buffer saveb; - - #ifdef O_HASDRIVES /* C: */ - if ( in[1] == ':' && isLetter(in[0]) ) -@@ -1097,7 +1096,8 @@ canoniseFileName(char *path) - in += 2; - if ( in[0] == '/' ) - *out++ = '/'; -- osave[osavep++] = out; -+ initBuffer(&saveb); -+ addBuffer(&saveb, out, char*); - - while(*in) - { if (*in == '/') -@@ -1113,15 +1113,15 @@ canoniseFileName(char *path) - } - if ( in[2] == EOS ) /* delete trailing /. */ - { *out = EOS; -- return path; -+ goto out; - } - if ( in[2] == '.' && (in[3] == '/' || in[3] == EOS) ) -- { if ( osavep > 0 ) /* delete /foo/../ */ -- { out = osave[--osavep]; -+ { if ( !isEmptyBuffer(&saveb) ) /* delete /foo/../ */ -+ { out = popBuffer(&saveb, char*); - in += 3; - if ( in[0] == EOS && out > start+1 ) - { out[-1] = EOS; /* delete trailing / */ -- return path; -+ goto out; - } - goto again; - } else if ( start[0] == '/' && out == start+1 ) -@@ -1135,11 +1135,14 @@ canoniseFileName(char *path) - in++; - if ( out > path && out[-1] != '/' ) - *out++ = '/'; -- osave[osavep++] = out; -+ addBuffer(&saveb, out, char*); - } else - *out++ = *in++; - } - *out++ = *in++; -+ -+out: -+ discardBuffer(&saveb); - - return path; - } Index: pkg/PFRAG.shared =================================================================== RCS file: /cvs/ports/lang/swi-prolog/pkg/PFRAG.shared,v retrieving revision 1.9 diff -u -p -r1.9 PFRAG.shared --- pkg/PFRAG.shared 1 Oct 2012 21:16:01 -0000 1.9 +++ pkg/PFRAG.shared 3 Jul 2013 09:15:47 -0000 @@ -1,5 +1,6 @@ @comment $OpenBSD: PFRAG.shared,v 1.9 2012/10/01 21:16:01 edd Exp $ @lib lib/libpl.so.${LIBpl_VERSION} +@lib lib/swipl-${V}/lib/${FULLARCH}/libpl.so.${LIBpl_VERSION} lib/swipl-${V}/lib/${FULLARCH}/cgi.so lib/swipl-${V}/lib/${FULLARCH}/crypt.so lib/swipl-${V}/lib/${FULLARCH}/double_metaphone.so @@ -7,7 +8,6 @@ lib/swipl-${V}/lib/${FULLARCH}/files.so lib/swipl-${V}/lib/${FULLARCH}/http_stream.so lib/swipl-${V}/lib/${FULLARCH}/isub.so lib/swipl-${V}/lib/${FULLARCH}/json.so -@lib lib/swipl-${V}/lib/${FULLARCH}/libpl.so.${LIBpl_VERSION} lib/swipl-${V}/lib/${FULLARCH}/libswipl.so lib/swipl-${V}/lib/${FULLARCH}/memfile.so lib/swipl-${V}/lib/${FULLARCH}/mime.so Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/lang/swi-prolog/pkg/PLIST,v retrieving revision 1.11 diff -u -p -r1.11 PLIST --- pkg/PLIST 1 Oct 2012 21:16:01 -0000 1.11 +++ pkg/PLIST 3 Jul 2013 09:15:57 -0000 @@ -503,6 +503,7 @@ lib/swipl-${V}/library/dialect/yap/ lib/swipl-${V}/library/dialect/yap.pl lib/swipl-${V}/library/dialect/yap/README.TXT lib/swipl-${V}/library/dif.pl +lib/swipl-${V}/library/doc_files.pl lib/swipl-${V}/library/doc_http.pl lib/swipl-${V}/library/doc_latex.pl lib/swipl-${V}/library/double_metaphone.pl @@ -603,6 +604,7 @@ lib/swipl-${V}/library/pldoc/doc_index.p lib/swipl-${V}/library/pldoc/doc_library.pl lib/swipl-${V}/library/pldoc/doc_man.pl lib/swipl-${V}/library/pldoc/doc_modes.pl +lib/swipl-${V}/library/pldoc/doc_pack.pl lib/swipl-${V}/library/pldoc/doc_process.pl lib/swipl-${V}/library/pldoc/doc_register.pl lib/swipl-${V}/library/pldoc/doc_search.pl @@ -636,6 +638,7 @@ lib/swipl-${V}/library/prolog_clause.pl lib/swipl-${V}/library/prolog_codewalk.pl lib/swipl-${V}/library/prolog_colour.pl lib/swipl-${V}/library/prolog_history.pl +lib/swipl-${V}/library/prolog_metainference.pl lib/swipl-${V}/library/prolog_pack.pl lib/swipl-${V}/library/prolog_server.pl lib/swipl-${V}/library/prolog_source.pl
-- Best Regards Edd Barrett http://www.theunixzoo.co.uk