From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Sep 11 11:30:04 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 064031065678 for ; Tue, 11 Sep 2012 11:30:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D4F008FC25 for ; Tue, 11 Sep 2012 11:30:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q8BBU3Kb034335 for ; Tue, 11 Sep 2012 11:30:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q8BBU3dP034314; Tue, 11 Sep 2012 11:30:03 GMT (envelope-from gnats) Resent-Date: Tue, 11 Sep 2012 11:30:03 GMT Resent-Message-Id: <201209111130.q8BBU3dP034314@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Michael Gmelin Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4E6111065673 for ; Tue, 11 Sep 2012 11:28:43 +0000 (UTC) (envelope-from freebsd@grem.de) Received: from mail.grem.de (outcast.grem.de [213.239.217.27]) by mx1.freebsd.org (Postfix) with SMTP id 740A48FC0C for ; Tue, 11 Sep 2012 11:28:41 +0000 (UTC) Received: (qmail 66869 invoked by uid 0); 11 Sep 2012 11:28:39 -0000 Message-Id: <20120911112839.66868.qmail@mail.grem.de> Date: 11 Sep 2012 11:28:39 -0000 From: Michael Gmelin To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: gahr@FreeBSD.org Subject: ports/171537: [PATCH] textproc/xerces-c3: Fix bug in ContentSpecNode and allow compilation using C++11 (Clang) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 11:30:04 -0000 >Number: 171537 >Category: ports >Synopsis: [PATCH] textproc/xerces-c3: Fix bug in ContentSpecNode and allow compilation using C++11 (Clang) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 11 11:30:03 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Michael Gmelin >Release: FreeBSD 9.1-RC1 amd64 >Organization: Grem Equity GmbH >Environment: System: FreeBSD clangcompile 9.1-RC1 FreeBSD 9.1-RC1 #1 r240177: Fri Sep 7 14:37:21 UTC 2012 >Description: Fix an operator precedence error in ContentSpecNode::getMaxTotalRange that leads to wrong max calculation in choices while parsing xml schemata (see also https://issues.apache.org/jira/browse/XERCESC-1994). Add static_cast to explicitely narrow down types to allow compilation using C++11. especially Clang, since it treats those as errors (see also https://issues.apache.org/jira/browse/XERCESC-1995) Added file(s): - files/patch-src-xercesc-util-XMLUTF8Transcoder.cpp - files/patch-src-xercesc-util-XMLUTF8Transcoder.hpp - files/patch-src-xercesc-util-regx-ParserForXMLSchema.cpp - files/patch-src-xercesc-util-regx-RegxParser.cpp - files/patch-src-xercesc-validators-common-ContentSpecNode.cpp Port maintainer (gahr@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.99_6 (mode: change, diff: suffix) >How-To-Repeat: >Fix: --- xerces-c3-3.1.1_1.patch begins here --- diff -ruN --exclude=CVS ../xerces-c3.orig/Makefile ./Makefile --- ../xerces-c3.orig/Makefile 2012-09-11 13:04:01.239569124 +0200 +++ ./Makefile 2012-09-11 13:04:15.272531693 +0200 @@ -7,6 +7,7 @@ PORTNAME= xerces-c3 PORTVERSION= 3.1.1 +PORTREVISION= 1 CATEGORIES= textproc MASTER_SITES= ${MASTER_SITE_APACHE} MASTER_SITE_SUBDIR= xerces/c/3/sources diff -ruN --exclude=CVS ../xerces-c3.orig/files/patch-src-xercesc-util-XMLUTF8Transcoder.cpp ./files/patch-src-xercesc-util-XMLUTF8Transcoder.cpp --- ../xerces-c3.orig/files/patch-src-xercesc-util-XMLUTF8Transcoder.cpp 1970-01-01 01:00:00.000000000 +0100 +++ ./files/patch-src-xercesc-util-XMLUTF8Transcoder.cpp 2012-09-11 13:07:20.169566372 +0200 @@ -0,0 +1,53 @@ +--- src.orig/xercesc/util/XMLUTF8Transcoder.cpp ++++ src/xercesc/util/XMLUTF8Transcoder.cpp +@@ -178,7 +178,7 @@ XMLUTF8Transcoder::transcodeFrom(const XMLByte* const srcData + if((gUTFByteIndicatorTest[trailingBytes] & *srcPtr) != gUTFByteIndicator[trailingBytes]) { + char pos[2] = {(char)0x31, 0}; + char len[2] = {(char)(trailingBytes+0x31), 0}; +- char byte[2] = {*srcPtr,0}; ++ char byte[2] = {static_cast(*srcPtr),0}; + ThrowXMLwithMemMgr3(UTFDataFormatException, XMLExcepts::UTF8_FormatError, pos, byte, len, getMemoryManager()); + } + +@@ -246,8 +246,8 @@ XMLUTF8Transcoder::transcodeFrom(const XMLByte* const srcData + // + if (( *srcPtr == 0xE0) && ( *(srcPtr+1) < 0xA0)) + { +- char byte0[2] = {*srcPtr ,0}; +- char byte1[2] = {*(srcPtr+1),0}; ++ char byte0[2] = {static_cast(*srcPtr) ,0}; ++ char byte1[2] = {static_cast(*(srcPtr+1)),0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Invalid_3BytesSeq +@@ -284,8 +284,8 @@ XMLUTF8Transcoder::transcodeFrom(const XMLByte* const srcData + + if ((*srcPtr == 0xED) && (*(srcPtr+1) >= 0xA0)) + { +- char byte0[2] = {*srcPtr, 0}; +- char byte1[2] = {*(srcPtr+1),0}; ++ char byte0[2] = {static_cast(*srcPtr), 0}; ++ char byte1[2] = {static_cast(*(srcPtr+1)),0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Irregular_3BytesSeq +@@ -310,8 +310,8 @@ XMLUTF8Transcoder::transcodeFrom(const XMLByte* const srcData + if (((*srcPtr == 0xF0) && (*(srcPtr+1) < 0x90)) || + ((*srcPtr == 0xF4) && (*(srcPtr+1) > 0x8F)) ) + { +- char byte0[2] = {*srcPtr ,0}; +- char byte1[2] = {*(srcPtr+1),0}; ++ char byte0[2] = {static_cast(*srcPtr) ,0}; ++ char byte1[2] = {static_cast(*(srcPtr+1)),0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Invalid_4BytesSeq +@@ -344,7 +344,7 @@ XMLUTF8Transcoder::transcodeFrom(const XMLByte* const srcData + * surrogates, nor U+FFFE and U+FFFF (but it does allow other noncharacters). + ***/ + char len[2] = {(char)(trailingBytes+0x31), 0}; +- char byte[2] = {*srcPtr,0}; ++ char byte[2] = {static_cast(*srcPtr),0}; + + ThrowXMLwithMemMgr2(UTFDataFormatException + , XMLExcepts::UTF8_Exceeds_BytesLimit diff -ruN --exclude=CVS ../xerces-c3.orig/files/patch-src-xercesc-util-XMLUTF8Transcoder.hpp ./files/patch-src-xercesc-util-XMLUTF8Transcoder.hpp --- ../xerces-c3.orig/files/patch-src-xercesc-util-XMLUTF8Transcoder.hpp 1970-01-01 01:00:00.000000000 +0100 +++ ./files/patch-src-xercesc-util-XMLUTF8Transcoder.hpp 2012-09-11 13:07:40.239741772 +0200 @@ -0,0 +1,11 @@ +--- src.orig/xercesc/util/XMLUTF8Transcoder.hpp ++++ src/xercesc/util/XMLUTF8Transcoder.hpp +@@ -107,7 +107,7 @@ void XMLUTF8Transcoder::checkTrailingBytes(const XMLByte toCheck + { + char len[2] = {(char)(trailingBytes+0x31), 0}; + char pos[2] = {(char)(position+0x31), 0}; +- char byte[2] = {toCheck,0}; ++ char byte[2] = {static_cast(toCheck),0}; + ThrowXMLwithMemMgr3(UTFDataFormatException, XMLExcepts::UTF8_FormatError, pos, byte, len, getMemoryManager()); + } + diff -ruN --exclude=CVS ../xerces-c3.orig/files/patch-src-xercesc-util-regx-ParserForXMLSchema.cpp ./files/patch-src-xercesc-util-regx-ParserForXMLSchema.cpp --- ../xerces-c3.orig/files/patch-src-xercesc-util-regx-ParserForXMLSchema.cpp 1970-01-01 01:00:00.000000000 +0100 +++ ./files/patch-src-xercesc-util-regx-ParserForXMLSchema.cpp 2012-09-11 13:08:12.329569948 +0200 @@ -0,0 +1,11 @@ +--- src.orig/xercesc/util/regx/ParserForXMLSchema.cpp ++++ src/xercesc/util/regx/ParserForXMLSchema.cpp +@@ -156,7 +156,7 @@ XMLInt32 ParserForXMLSchema::decodeEscaped() { + break; + default: + { +- XMLCh chString[] = {chBackSlash, ch, chNull}; ++ XMLCh chString[] = {chBackSlash, static_cast(ch), chNull}; + ThrowXMLwithMemMgr1(ParseException,XMLExcepts::Parser_Process2, chString, getMemoryManager()); + } + } diff -ruN --exclude=CVS ../xerces-c3.orig/files/patch-src-xercesc-util-regx-RegxParser.cpp ./files/patch-src-xercesc-util-regx-RegxParser.cpp --- ../xerces-c3.orig/files/patch-src-xercesc-util-regx-RegxParser.cpp 1970-01-01 01:00:00.000000000 +0100 +++ ./files/patch-src-xercesc-util-regx-RegxParser.cpp 2012-09-11 13:08:38.879723669 +0200 @@ -0,0 +1,43 @@ +--- src.orig/xercesc/util/regx/RegxParser.cpp ++++ src/xercesc/util/regx/RegxParser.cpp +@@ -691,11 +691,11 @@ RangeToken* RegxParser::parseCharacterClass(const bool useNRange) { + || (ch == chDash && getCharData() == chCloseSquare && firstLoop))) { + // if regex = [-] then invalid... + // '[', ']', '-' not allowed and should be escaped +- XMLCh chStr[] = { ch, chNull }; ++ XMLCh chStr[] = { static_cast(ch), chNull }; + ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_CC6, chStr, chStr, getMemoryManager()); + } + if (ch == chDash && getCharData() == chDash && getState() != REGX_T_BACKSOLIDUS && !wasDecoded) { +- XMLCh chStr[] = { ch, chNull }; ++ XMLCh chStr[] = { static_cast(ch), chNull }; + ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_CC6, chStr, chStr, getMemoryManager()); + } + +@@ -720,7 +720,7 @@ RangeToken* RegxParser::parseCharacterClass(const bool useNRange) { + else { + + XMLInt32 rangeEnd = getCharData(); +- XMLCh rangeEndStr[] = { rangeEnd, chNull }; ++ XMLCh rangeEndStr[] = { static_cast(rangeEnd), chNull }; + + if (type == REGX_T_CHAR) { + +@@ -737,7 +737,7 @@ RangeToken* RegxParser::parseCharacterClass(const bool useNRange) { + processNext(); + + if (ch > rangeEnd) { +- XMLCh chStr[] = { ch, chNull }; ++ XMLCh chStr[] = { static_cast(ch), chNull }; + ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_Ope3, rangeEndStr, chStr, getMemoryManager()); + } + +@@ -845,7 +845,7 @@ XMLInt32 RegxParser::decodeEscaped() { + break; + default: + { +- XMLCh chString[] = {chBackSlash, ch, chNull}; ++ XMLCh chString[] = {chBackSlash, static_cast(ch), chNull}; + ThrowXMLwithMemMgr1(ParseException,XMLExcepts::Parser_Process2, chString, getMemoryManager()); + } + } diff -ruN --exclude=CVS ../xerces-c3.orig/files/patch-src-xercesc-validators-common-ContentSpecNode.cpp ./files/patch-src-xercesc-validators-common-ContentSpecNode.cpp --- ../xerces-c3.orig/files/patch-src-xercesc-validators-common-ContentSpecNode.cpp 1970-01-01 01:00:00.000000000 +0100 +++ ./files/patch-src-xercesc-validators-common-ContentSpecNode.cpp 2012-09-11 13:09:09.899729005 +0200 @@ -0,0 +1,11 @@ +--- src.orig/xercesc/validators/common/ContentSpecNode.cpp ++++ src/xercesc/validators/common/ContentSpecNode.cpp +@@ -259,7 +259,7 @@ int ContentSpecNode::getMaxTotalRange() const { + else { + + if ((fType & 0x0f) == ContentSpecNode::Choice) { +- max = max * (maxFirst > maxSecond) ? maxFirst : maxSecond; ++ max = max * ((maxFirst > maxSecond) ? maxFirst : maxSecond); + } + else { + max = max * (maxFirst + maxSecond); --- xerces-c3-3.1.1_1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: