1
0
MozillaFirefox/mozilla-bmo1504834-part2.patch
Wolfgang Rosenauer a9628fa6ae - Mozilla Firefox 74.0
* https://www.mozilla.org/en-US/firefox/74.0/releasenotes/
  MFSA 2020-08 (bsc#1166238)
  * CVE-2020-6805 (bmo#1610880)
    Use-after-free when removing data about origins
  * CVE-2020-6806 (bmo#1612308)
    BodyStream::OnInputStreamReady was missing protections against
    state confusion
  * CVE-2020-6807 (bmo#1614971)
    Use-after-free in cubeb during stream destruction
  * CVE-2020-6808 (bmo#1247968)
    URL Spoofing via javascript: URL
  * CVE-2020-6809 (bmo#1420296)
    Web Extensions with the all-urls permission could access local
    files
  * CVE-2020-6810 (bmo#1432856)
    Focusing a popup while in fullscreen could have obscured the
    fullscreen notification
  * CVE-2020-6811 (bmo#1607742)
    Devtools' 'Copy as cURL' feature did not fully escape
    website-controlled data, potentially leading to command injection
  * CVE-2019-20503 (bmo#1613765)
    Out of bounds reads in sctp_load_addresses_from_init
  * CVE-2020-6812 (bmo#1616661)
    The names of AirPods with personally identifiable information
    were exposed to websites with camera or microphone permission
  * CVE-2020-6813 (bmo#1605814)
    @import statements in CSS could bypass the Content Security
    Policy nonce feature
  * CVE-2020-6814 (bmo#1592078,bmo#1604847,bmo#1608256,bmo#1612636,

OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox?expand=0&rev=809
2020-03-12 19:14:24 +00:00

113 lines
4.2 KiB
Diff

# HG changeset patch
# Parent 9319844dca3133fa8bd7107079f1d1ddc5c0bf70
Skia does not support big endian. The places to fix are too numerous and upstream (skia, not Mozilla)
has no interest in maintaining big endian.
So here we try to swizzle the input for skia, so that skia always works on LE, and when it comes
out again, we transform back to BE.
diff --git a/gfx/2d/ConvolutionFilter.cpp b/gfx/2d/ConvolutionFilter.cpp
--- a/gfx/2d/ConvolutionFilter.cpp
+++ b/gfx/2d/ConvolutionFilter.cpp
@@ -29,32 +29,79 @@ bool ConvolutionFilter::GetFilterOffsetA
int32_t* aResultLength) {
if (aRowIndex >= mFilter->numValues()) {
return false;
}
mFilter->FilterForValue(aRowIndex, aResultOffset, aResultLength);
return true;
}
+static void ByteSwapArray(uint8_t *u8Array, int32_t size) {
+ uint32_t *array = reinterpret_cast<uint32_t*>(u8Array);
+ for (int pxl = 0; pxl < size; ++pxl) {
+ // Use an endian swap to move the bytes, i.e. BGRA -> ARGB.
+ uint32_t rgba = array[pxl];
+ array[pxl] = NativeEndian::swapToLittleEndian(rgba);
+ }
+}
+
void ConvolutionFilter::ConvolveHorizontally(const uint8_t* aSrc, uint8_t* aDst,
bool aHasAlpha) {
+#if MOZ_BIG_ENDIAN()
+ int outputSize = mFilter->numValues();
+
+ // Input size isn't handed in, so we have to calculate it quickly
+ int inputSize = 0;
+ for (int xx = 0; xx < outputSize; ++xx) {
+ // Get the filter that determines the current output pixel.
+ int filterOffset, filterLength;
+ mFilter->FilterForValue(xx, &filterOffset, &filterLength);
+ inputSize = std::max(inputSize, filterOffset + filterLength);
+ }
+
+ ByteSwapArray((uint8_t*)aSrc, inputSize);
+#endif
+
SkOpts::convolve_horizontally(aSrc, *mFilter, aDst, aHasAlpha);
+
+#if MOZ_BIG_ENDIAN()
+ ByteSwapArray((uint8_t*)aSrc, inputSize);
+ ByteSwapArray(aDst, outputSize);
+#endif
}
void ConvolutionFilter::ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst,
int32_t aRowIndex, int32_t aRowSize,
bool aHasAlpha) {
MOZ_ASSERT(aRowIndex < mFilter->numValues());
int32_t filterOffset;
int32_t filterLength;
auto filterValues =
mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength);
+
+#if MOZ_BIG_ENDIAN()
+ for (int filterY = 0; filterY < filterLength; filterY++) {
+ // Skia only knows LE, so we have to swizzle the input
+ ByteSwapArray(aSrc[filterY], aRowSize);
+ }
+#endif
+
SkOpts::convolve_vertically(filterValues, filterLength, aSrc, aRowSize, aDst,
aHasAlpha);
+
+#if MOZ_BIG_ENDIAN()
+ // After skia is finished, we swizzle back to BE, in case
+ // the input is used again somewhere else
+ for (int filterY = 0; filterY < filterLength; filterY++) {
+ ByteSwapArray(aSrc[filterY], aRowSize);
+ }
+ // The destination array as well
+ ByteSwapArray(aDst, aRowSize);
+#endif
}
/* ConvolutionFilter::ComputeResizeFactor is derived from Skia's
* SkBitmapScaler/SkResizeFilter::computeFactors. It is governed by Skia's
* BSD-style license (see gfx/skia/LICENSE) and the following copyright:
* Copyright (c) 2015 Google Inc.
*/
bool ConvolutionFilter::ComputeResizeFilter(ResizeMethod aResizeMethod,
diff --git a/gfx/skia/skia/include/core/SkPreConfig.h b/gfx/skia/skia/include/core/SkPreConfig.h
--- a/gfx/skia/skia/include/core/SkPreConfig.h
+++ b/gfx/skia/skia/include/core/SkPreConfig.h
@@ -68,17 +68,17 @@
#define SK_CPU_BENDIAN
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SK_CPU_LENDIAN
#elif defined(__sparc) || defined(__sparc__) || \
defined(_POWER) || defined(__powerpc__) || \
defined(__ppc__) || defined(__hppa) || \
defined(__PPC__) || defined(__PPC64__) || \
defined(_MIPSEB) || defined(__ARMEB__) || \
- defined(__s390__) || \
+ defined(__s390__) || defined(__s390x__) || \
(defined(__sh__) && defined(__BIG_ENDIAN__)) || \
(defined(__ia64) && defined(__BIG_ENDIAN__))
#define SK_CPU_BENDIAN
#else
#define SK_CPU_LENDIAN
#endif
#endif