diff options
author | martin <martin@pkgsrc.org> | 2015-02-14 07:59:24 +0000 |
---|---|---|
committer | martin <martin@pkgsrc.org> | 2015-02-14 07:59:24 +0000 |
commit | f03cb6f9c32cd683ac0d2bab821fcc7954851415 (patch) | |
tree | 2ca37aa33001feeecf72bbdccdf5d33683ae3ad1 /www/firefox/patches | |
parent | 23aeed5922574c19ca7e0d64d8a1c6789db9f083 (diff) | |
download | pkgsrc-f03cb6f9c32cd683ac0d2bab821fcc7954851415.tar.gz |
Another try at proper alignment fixes for http2 sessions
Diffstat (limited to 'www/firefox/patches')
-rw-r--r-- | www/firefox/patches/patch-netwerk_base_public_nsNetUtil.h | 42 | ||||
-rw-r--r-- | www/firefox/patches/patch-netwerk_protocol_http_Http2Session.cpp | 94 |
2 files changed, 136 insertions, 0 deletions
diff --git a/www/firefox/patches/patch-netwerk_base_public_nsNetUtil.h b/www/firefox/patches/patch-netwerk_base_public_nsNetUtil.h new file mode 100644 index 00000000000..5c67b7aeb64 --- /dev/null +++ b/www/firefox/patches/patch-netwerk_base_public_nsNetUtil.h @@ -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 --git a/www/firefox/patches/patch-netwerk_protocol_http_Http2Session.cpp b/www/firefox/patches/patch-netwerk_protocol_http_Http2Session.cpp new file mode 100644 index 00000000000..b65ecc4aad9 --- /dev/null +++ b/www/firefox/patches/patch-netwerk_protocol_http_Http2Session.cpp @@ -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; + |