pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/firefox Another try at proper alignment fixes for ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e226a2d68e8e
branches:  trunk
changeset: 646743:e226a2d68e8e
user:      martin <martin%pkgsrc.org@localhost>
date:      Sat Feb 14 07:59:24 2015 +0000

description:
Another try at proper alignment fixes for http2 sessions

diffstat:

 www/firefox/Makefile                                             |   4 +-
 www/firefox/distinfo                                             |   4 +-
 www/firefox/patches/patch-netwerk_base_public_nsNetUtil.h        |  42 ++++
 www/firefox/patches/patch-netwerk_protocol_http_Http2Session.cpp |  94 ++++++++++
 4 files changed, 141 insertions(+), 3 deletions(-)

diffs (182 lines):

diff -r 097c545b2049 -r e226a2d68e8e www/firefox/Makefile
--- a/www/firefox/Makefile      Sat Feb 14 07:58:13 2015 +0000
+++ b/www/firefox/Makefile      Sat Feb 14 07:59:24 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.192 2015/02/12 13:50:22 wiz Exp $
+# $NetBSD: Makefile,v 1.193 2015/02/14 07:59:24 martin Exp $
 
 FIREFOX_VER=   ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
 MOZ_BRANCH=    35.0
@@ -6,7 +6,7 @@
 
 DISTNAME=      firefox-${FIREFOX_VER}.source
 PKGNAME=       firefox-${MOZ_BRANCH}${MOZ_BRANCH_MINOR:S/b/beta/:S/esr//}
-PKGREVISION=   3
+PKGREVISION=   4
 CATEGORIES=    www
 MASTER_SITES=  ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
 MASTER_SITES+= ${MASTER_SITE_MOZILLA_ALL:=firefox/releases/${FIREFOX_VER}/source/}
diff -r 097c545b2049 -r e226a2d68e8e www/firefox/distinfo
--- a/www/firefox/distinfo      Sat Feb 14 07:58:13 2015 +0000
+++ b/www/firefox/distinfo      Sat Feb 14 07:59:24 2015 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.184 2015/02/12 13:50:22 wiz Exp $
+$NetBSD: distinfo,v 1.185 2015/02/14 07:59:24 martin Exp $
 
 SHA1 (firefox-35.0.1.source.tar.bz2) = cf256ee1491ee502eb4432ade5a879104ebceede
 RMD160 (firefox-35.0.1.source.tar.bz2) = ca4dc6f6c5de1e6e69133de3b8b502991d519fa7
@@ -117,8 +117,10 @@
 SHA1 (patch-mfbt_Attributes.h) = 0cf62084c0220a3fa46226714cea5c30b1b155e9
 SHA1 (patch-mfbt_Poison.cpp) = f502581db96b3e5eca25a9aa9035f436e9167503
 SHA1 (patch-modules_libjar_nsZipArchive.cpp) = 6aff0f8ed42575d8ca36a524e12e9a1f7351004a
+SHA1 (patch-netwerk_base_public_nsNetUtil.h) = 764c6b776f7f9b38d260fb866eddf15f38bd5050
 SHA1 (patch-netwerk_dns_Makefile.in) = b6bd9814d909dd6f7cff10dbeac3bedd79c2508e
 SHA1 (patch-netwerk_dns_moz.build) = 01dd7d9094ddaeffbcd6cfa296e28fb56681b0e6
+SHA1 (patch-netwerk_protocol_http_Http2Session.cpp) = 3e8904ef4c7ac3ab8a821ed82e5ca55484ecfb55
 SHA1 (patch-netwerk_wifi_moz.build) = 7c84003d442f698b030f3fef91fea2f5537b404c
 SHA1 (patch-netwerk_wifi_nsWifiScannerFreeBSD.cpp) = d43961a396bccc6bbe1dba2b4c1f97d5017c6d6d
 SHA1 (patch-pb) = 97c9b2e4cefd524dc6ba825f71c3da2a761aa1f4
diff -r 097c545b2049 -r e226a2d68e8e www/firefox/patches/patch-netwerk_base_public_nsNetUtil.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/firefox/patches/patch-netwerk_base_public_nsNetUtil.h Sat Feb 14 07:59:24 2015 +0000
@@ -0,0 +1,42 @@
+$NetBSD: patch-netwerk_base_public_nsNetUtil.h,v 1.1 2015/02/14 07:59:24 martin Exp $
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1130822
+Fix obivous alignment issues (causing crashes on some architectures).
+
+--- netwerk/base/public/nsNetUtil.h.orig       2015-01-23 07:00:06.000000000 +0100
++++ netwerk/base/public/nsNetUtil.h    2015-02-13 08:51:18.000000000 +0100
+@@ -13,6 +13,7 @@
+ #include "nsMemory.h"
+ #include "nsCOMPtr.h"
+ #include "prio.h" // for read/write flags, permissions, etc.
++#include "prnetdb.h"
+ #include "nsHashKeys.h"
+ 
+ #include "plstr.h"
+@@ -2717,6 +2718,26 @@
+ bool NS_IsReasonableHTTPHeaderValue(const nsACString& aValue);
+ 
+ /**
++ * Return a host endian value decoded from network byte order,
++ * accessed in an alignement safe way.
++ */
++inline uint16_t NS_decodeN16(const void *bytes)
++{
++    uint16_t tmp;
++
++    memcpy(&tmp, bytes, sizeof tmp);
++    return PR_ntohs(tmp);
++}
++
++inline uint32_t NS_decodeN32(const void *bytes)
++{
++    uint32_t tmp;
++
++    memcpy(&tmp, bytes, sizeof tmp);
++    return PR_ntohl(tmp);
++}
++
++/**
+  * Return true if the given string is a valid HTTP token per RFC 2616 section
+  * 2.2.
+  */
diff -r 097c545b2049 -r e226a2d68e8e www/firefox/patches/patch-netwerk_protocol_http_Http2Session.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/firefox/patches/patch-netwerk_protocol_http_Http2Session.cpp  Sat Feb 14 07:59:24 2015 +0000
@@ -0,0 +1,94 @@
+$NetBSD: patch-netwerk_protocol_http_Http2Session.cpp,v 1.3 2015/02/14 07:59:24 martin Exp $
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1130822
+Fix obivous alignment issues (causing crashes on some architectures).
+
+--- netwerk/protocol/http/Http2Session.cpp.orig        2015-01-23 07:00:06.000000000 +0100
++++ netwerk/protocol/http/Http2Session.cpp     2015-02-13 08:50:19.000000000 +0100
+@@ -30,7 +30,6 @@
+ #include "nsISSLStatusProvider.h"
+ #include "nsISupportsPriority.h"
+ #include "prprf.h"
+-#include "prnetdb.h"
+ #include "sslt.h"
+ 
+ #ifdef DEBUG
+@@ -1289,7 +1288,7 @@
+     return rv;
+ 
+   uint32_t newPriorityDependency =
+-    PR_ntohl(*reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get() + kFrameHeaderBytes));
++    NS_decodeN32(self->mInputFrameBuffer.get() + kFrameHeaderBytes);
+   bool exclusive = !!(newPriorityDependency & 0x80000000);
+   newPriorityDependency &= 0x7fffffff;
+   uint8_t newPriorityWeight = *(self->mInputFrameBuffer.get() + kFrameHeaderBytes + 4);
+@@ -1320,7 +1319,7 @@
+   }
+ 
+   self->mDownstreamRstReason =
+-    PR_ntohl(*reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get() + kFrameHeaderBytes));
++    NS_decodeN32(self->mInputFrameBuffer.get() + kFrameHeaderBytes);
+ 
+   LOG3(("Http2Session::RecvRstStream %p RST_STREAM Reason Code %u ID %x\n",
+         self, self->mDownstreamRstReason, self->mInputFrameID));
+@@ -1381,8 +1380,8 @@
+     uint8_t *setting = reinterpret_cast<uint8_t *>
+       (self->mInputFrameBuffer.get()) + kFrameHeaderBytes + index * 6;
+ 
+-    uint16_t id = PR_ntohs(*reinterpret_cast<uint16_t *>(setting));
+-    uint32_t value = PR_ntohl(*reinterpret_cast<uint32_t *>(setting + 2));
++    uint16_t id = NS_decodeN16(setting);
++    uint32_t value = NS_decodeN32(setting + 2);
+     LOG3(("Settings ID %u, Value %u", id, value));
+ 
+     switch (id)
+@@ -1467,7 +1466,7 @@
+     }
+     promiseLen = 4;
+     promisedID =
+-      PR_ntohl(*reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get() + kFrameHeaderBytes + paddingControlBytes));
++      NS_decodeN32(self->mInputFrameBuffer.get() + kFrameHeaderBytes + paddingControlBytes);
+     promisedID &= 0x7fffffff;
+   }
+ 
+@@ -1702,11 +1701,11 @@
+ 
+   self->mShouldGoAway = true;
+   self->mGoAwayID =
+-    PR_ntohl(*reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get() + kFrameHeaderBytes));
++    NS_decodeN32(self->mInputFrameBuffer.get() + kFrameHeaderBytes);
+   self->mGoAwayID &= 0x7fffffff;
+   self->mCleanShutdown = true;
+   uint32_t statusCode =
+-    PR_ntohl(*reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get() + kFrameHeaderBytes + 4));
++    NS_decodeN32(self->mInputFrameBuffer.get() + kFrameHeaderBytes + 4);
+ 
+   // Find streams greater than the last-good ID and mark them for deletion
+   // in the mGoAwayStreamsToRestart queue with the GoAwayEnumerator. The
+@@ -1772,7 +1771,7 @@
+   }
+ 
+   uint32_t delta =
+-    PR_ntohl(*reinterpret_cast<uint32_t *>(self->mInputFrameBuffer.get() + kFrameHeaderBytes));
++    NS_decodeN32(self->mInputFrameBuffer.get() + kFrameHeaderBytes);
+   delta &= 0x7fffffff;
+ 
+   LOG3(("Http2Session::RecvWindowUpdate %p len=%d Stream 0x%X.\n",
+@@ -2416,7 +2415,7 @@
+ 
+     // 3 bytes of length, 1 type byte, 1 flag byte, 1 unused bit, 31 bits of ID
+     uint8_t totallyWastedByte = mInputFrameBuffer.get()[0];
+-    mInputFrameDataSize = PR_ntohs(*reinterpret_cast<uint16_t *>(mInputFrameBuffer.get() + 1));
++    mInputFrameDataSize = NS_decodeN16(mInputFrameBuffer.get() + 1);
+     if (totallyWastedByte || (mInputFrameDataSize > kMaxFrameData)) {
+       LOG3(("Got frame too large 0x%02X%04X", totallyWastedByte, mInputFrameDataSize));
+       RETURN_SESSION_ERROR(this, PROTOCOL_ERROR);
+@@ -2424,7 +2423,7 @@
+     mInputFrameType = *reinterpret_cast<uint8_t *>(mInputFrameBuffer.get() + kFrameLengthBytes);
+     mInputFrameFlags = *reinterpret_cast<uint8_t *>(mInputFrameBuffer.get() + kFrameLengthBytes + kFrameTypeBytes);
+     mInputFrameID =
+-      PR_ntohl(*reinterpret_cast<uint32_t *>(mInputFrameBuffer.get() + kFrameLengthBytes + kFrameTypeBytes + kFrameFlagBytes));
++      NS_decodeN32(mInputFrameBuffer.get() + kFrameLengthBytes + kFrameTypeBytes + kFrameFlagBytes);
+     mInputFrameID &= 0x7fffffff;
+     mInputFrameDataRead = 0;
+ 



Home | Main Index | Thread Index | Old Index