aboutsummaryrefslogtreecommitdiff
path: root/textproc/expat2
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-08-11 22:06:20 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-08-11 22:06:20 +0000
commitc5eb3d13428d8892edee2963b0c8dda39c724579 (patch)
tree72439f5bcfd713c87d0b9aed9eaf185b3f506619 /textproc/expat2
parent4c5a99a5cf37d78db91039490f223a6a2c625859 (diff)
downloadports-c5eb3d13428d8892edee2963b0c8dda39c724579.tar.gz
ports-c5eb3d13428d8892edee2963b0c8dda39c724579.zip
Notes
Diffstat (limited to 'textproc/expat2')
-rw-r--r--textproc/expat2/Makefile4
-rw-r--r--textproc/expat2/files/CVE-2015-1283.patch77
2 files changed, 80 insertions, 1 deletions
diff --git a/textproc/expat2/Makefile b/textproc/expat2/Makefile
index 7d6aa1d8676b..5625702b87da 100644
--- a/textproc/expat2/Makefile
+++ b/textproc/expat2/Makefile
@@ -3,7 +3,7 @@
PORTNAME= expat
PORTVERSION= 2.1.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= textproc
MASTER_SITES= SF
@@ -15,6 +15,8 @@ ALL_TARGET= default
USES= libtool pathfix
USE_LDCONFIG= yes
+EXTRA_PATCHES= ${FILESDIR}/CVE-2015-1283.patch:-p1
+
post-patch:
@${REINPLACE_CMD} -e '/^DESTDIR =/d' ${WRKSRC}/Makefile.in
diff --git a/textproc/expat2/files/CVE-2015-1283.patch b/textproc/expat2/files/CVE-2015-1283.patch
new file mode 100644
index 000000000000..33b975912d40
--- /dev/null
+++ b/textproc/expat2/files/CVE-2015-1283.patch
@@ -0,0 +1,77 @@
+Found at https://hg.mozilla.org/releases/mozilla-esr31/rev/2f3e78643f5c on 2015-07-27. Modified: replaced path parser/expat/lib/xmlparse.c with lib/xmlparse.c.
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -1646,29 +1646,40 @@ XML_ParseBuffer(XML_Parser parser, int l
+ XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
+ positionPtr = bufferPtr;
+ return result;
+ }
+
+ void * XMLCALL
+ XML_GetBuffer(XML_Parser parser, int len)
+ {
++/* BEGIN MOZILLA CHANGE (sanity check len) */
++ if (len < 0) {
++ errorCode = XML_ERROR_NO_MEMORY;
++ return NULL;
++ }
++/* END MOZILLA CHANGE */
+ switch (ps_parsing) {
+ case XML_SUSPENDED:
+ errorCode = XML_ERROR_SUSPENDED;
+ return NULL;
+ case XML_FINISHED:
+ errorCode = XML_ERROR_FINISHED;
+ return NULL;
+ default: ;
+ }
+
+ if (len > bufferLim - bufferEnd) {
+- /* FIXME avoid integer overflow */
+ int neededSize = len + (int)(bufferEnd - bufferPtr);
++/* BEGIN MOZILLA CHANGE (sanity check neededSize) */
++ if (neededSize < 0) {
++ errorCode = XML_ERROR_NO_MEMORY;
++ return NULL;
++ }
++/* END MOZILLA CHANGE */
+ #ifdef XML_CONTEXT_BYTES
+ int keep = (int)(bufferPtr - buffer);
+
+ if (keep > XML_CONTEXT_BYTES)
+ keep = XML_CONTEXT_BYTES;
+ neededSize += keep;
+ #endif /* defined XML_CONTEXT_BYTES */
+ if (neededSize <= bufferLim - buffer) {
+@@ -1687,17 +1698,25 @@ XML_GetBuffer(XML_Parser parser, int len
+ }
+ else {
+ char *newBuf;
+ int bufferSize = (int)(bufferLim - bufferPtr);
+ if (bufferSize == 0)
+ bufferSize = INIT_BUFFER_SIZE;
+ do {
+ bufferSize *= 2;
+- } while (bufferSize < neededSize);
++/* BEGIN MOZILLA CHANGE (prevent infinite loop on overflow) */
++ } while (bufferSize < neededSize && bufferSize > 0);
++/* END MOZILLA CHANGE */
++/* BEGIN MOZILLA CHANGE (sanity check bufferSize) */
++ if (bufferSize <= 0) {
++ errorCode = XML_ERROR_NO_MEMORY;
++ return NULL;
++ }
++/* END MOZILLA CHANGE */
+ newBuf = (char *)MALLOC(bufferSize);
+ if (newBuf == 0) {
+ errorCode = XML_ERROR_NO_MEMORY;
+ return NULL;
+ }
+ bufferLim = newBuf + bufferSize;
+ #ifdef XML_CONTEXT_BYTES
+ if (bufferPtr) {
+
+
+
+