diff options
63 files changed, 523 insertions, 203 deletions
diff --git a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm index 3b9f9de26..5e337bbc5 100644 --- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm +++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm @@ -29,7 +29,8 @@ const MOZ_CENTRAL = JSON.parse('true'); const PDFJS_EVENT_ID = 'pdf.js.message'; const PDF_CONTENT_TYPE = 'application/pdf'; const PREF_PREFIX = 'pdfjs'; -const PDF_VIEWER_WEB_PAGE = 'resource://pdf.js/web/viewer.html'; +const PDF_VIEWER_ORIGIN = "resource://pdf.js"; +const PDF_VIEWER_WEB_PAGE = "resource://pdf.js/web/viewer.html"; const MAX_NUMBER_OF_PREFS = 50; const MAX_STRING_PREF_LENGTH = 128; @@ -110,11 +111,15 @@ function log(aMsg) { dump(msg + '\n'); } -function getDOMWindow(aChannel) { +function getDOMWindow(aChannel, aPrincipal) { var requestor = aChannel.notificationCallbacks ? aChannel.notificationCallbacks : aChannel.loadGroup.notificationCallbacks; var win = requestor.getInterface(Components.interfaces.nsIDOMWindow); + // Ensure the window wasn't navigated to something that is not PDF.js. + if (!win.document.nodePrincipal.equals(aPrincipal)) { + return null; + } return win; } @@ -632,7 +637,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() { loaded: loaded, total: total, chunk: self.dataListener.readData() - }, '*'); + }, PDF_VIEWER_ORIGIN); }; this.dataListener.oncomplete = function () { self.dataListener = null; @@ -646,7 +651,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() { pdfUrl: this.pdfUrl, length: this.contentLength, data: data - }, '*'); + }, PDF_VIEWER_ORIGIN); return true; }; @@ -668,13 +673,13 @@ var RangedChromeActions = (function RangedChromeActionsClosure() { pdfjsLoadAction: 'range', begin: args.begin, chunk: args.chunk - }, '*'); + }, PDF_VIEWER_ORIGIN); }, onProgress: function RangedChromeActions_onProgress(evt) { domWindow.postMessage({ pdfjsLoadAction: 'rangeProgress', loaded: evt.loaded, - }, '*'); + }, PDF_VIEWER_ORIGIN); } }); }; @@ -723,7 +728,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() { pdfjsLoadAction: 'progress', loaded: loaded, total: total - }, '*'); + }, PDF_VIEWER_ORIGIN); }; this.dataListener.oncomplete = @@ -732,7 +737,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() { pdfjsLoadAction: 'complete', data: data, errorCode: errorCode - }, '*'); + }, PDF_VIEWER_ORIGIN); self.dataListener = null; self.originalRequest = null; @@ -977,10 +982,14 @@ PdfStreamConverter.prototype = { listener.onDataAvailable(aRequest, aContext, inputStream, offset, count); }, - onStopRequest: function(request, context, statusCode) { - // We get the DOM window here instead of before the request since it - // may have changed during a redirect. - var domWindow = getDOMWindow(channel); + onStopRequest(request, context, statusCode) { + var domWindow = getDOMWindow(channel, resourcePrincipal); + if (!Components.isSuccessCode(statusCode) || !domWindow) { + // The request may have been aborted and the document may have been + // replaced with something that is not PDF.js, abort attaching. + listener.onStopRequest(aRequest, context, statusCode); + return; + } var actions; if (rangeRequest || streamRequest) { actions = new RangedChromeActions( @@ -991,7 +1000,7 @@ PdfStreamConverter.prototype = { domWindow, contentDispositionFilename, aRequest, dataListener); } var requestListener = new RequestListener(actions); - domWindow.addEventListener(PDFJS_EVENT_ID, function(event) { + domWindow.document.addEventListener(PDFJS_EVENT_ID, function(event) { requestListener.receive(event); }, false, true); if (actions.supportsIntegratedFind()) { diff --git a/browser/extensions/pdfjs/content/build/pdf.worker.js b/browser/extensions/pdfjs/content/build/pdf.worker.js index 4c35bd401..6ce519940 100644 --- a/browser/extensions/pdfjs/content/build/pdf.worker.js +++ b/browser/extensions/pdfjs/content/build/pdf.worker.js @@ -41653,6 +41653,22 @@ var isStream = corePrimitives.isStream; var PostScriptLexer = corePsParser.PostScriptLexer; var PostScriptParser = corePsParser.PostScriptParser; + function toNumberArray(arr) { + if (!Array.isArray(arr)) { + return null; + } + var length = arr.length; + for (var i = 0; i < length; i++) { + if (typeof arr[i] !== 'number') { + var result = new Array(length); + for (var j = 0; j < length; j++) { + result[j] = +arr[j]; + } + return result; + } + } + return arr; + } var PDFFunction = function PDFFunctionClosure() { var CONSTRUCT_SAMPLED = 0; var CONSTRUCT_INTERPOLATED = 2; @@ -41752,8 +41768,8 @@ } return out; } - var domain = dict.getArray('Domain'); - var range = dict.getArray('Range'); + var domain = toNumberArray(dict.getArray('Domain')); + var range = toNumberArray(dict.getArray('Range')); if (!domain || !range) { error('No domain or range'); } @@ -41761,7 +41777,7 @@ var outputSize = range.length / 2; domain = toMultiArray(domain); range = toMultiArray(range); - var size = dict.get('Size'); + var size = toNumberArray(dict.get('Size')); var bps = dict.get('BitsPerSample'); var order = dict.get('Order') || 1; if (order !== 1) { @@ -41769,16 +41785,16 @@ // As in poppler, ignoring order, linear interpolation may work as good info('No support for cubic spline interpolation: ' + order); } - var encode = dict.getArray('Encode'); + var encode = toNumberArray(dict.getArray('Encode')); if (!encode) { encode = []; for (var i = 0; i < inputSize; ++i) { - encode.push(0); - encode.push(size[i] - 1); + encode.push([0, size[i] - 1]); } + } else { + encode = toMultiArray(encode); } - encode = toMultiArray(encode); - var decode = dict.getArray('Decode'); + var decode = toNumberArray(dict.getArray('Decode')); if (!decode) { decode = range; } else { @@ -41873,12 +41889,9 @@ }; }, constructInterpolated: function PDFFunction_constructInterpolated(str, dict) { - var c0 = dict.getArray('C0') || [0]; - var c1 = dict.getArray('C1') || [1]; + var c0 = toNumberArray(dict.getArray('C0')) || [0]; + var c1 = toNumberArray(dict.getArray('C1')) || [1]; var n = dict.get('N'); - if (!isArray(c0) || !isArray(c1)) { - error('Illegal dictionary for interpolated function'); - } var length = c0.length; var diff = []; for (var i = 0; i < length; ++i) { @@ -41904,7 +41917,7 @@ }; }, constructStiched: function PDFFunction_constructStiched(fn, dict, xref) { - var domain = dict.getArray('Domain'); + var domain = toNumberArray(dict.getArray('Domain')); if (!domain) { error('No domain'); } @@ -41915,10 +41928,10 @@ var fnRefs = dict.get('Functions'); var fns = []; for (var i = 0, ii = fnRefs.length; i < ii; ++i) { - fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i]))); + fns.push(PDFFunction.parse(xref, xref.fetchIfRef(fnRefs[i]))); } - var bounds = dict.getArray('Bounds'); - var encode = dict.getArray('Encode'); + var bounds = toNumberArray(dict.getArray('Bounds')); + var encode = toNumberArray(dict.getArray('Encode')); return [ CONSTRUCT_STICHED, domain, @@ -41931,12 +41944,8 @@ var domain = IR[1]; var bounds = IR[2]; var encode = IR[3]; - var fnsIR = IR[4]; - var fns = []; + var fns = IR[4]; var tmpBuf = new Float32Array(1); - for (var i = 0, ii = fnsIR.length; i < ii; i++) { - fns.push(PDFFunction.fromIR(fnsIR[i])); - } return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) { var clip = function constructStichedFromIRClip(v, min, max) { if (v > max) { @@ -41973,8 +41982,8 @@ }; }, constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) { - var domain = dict.getArray('Domain'); - var range = dict.getArray('Range'); + var domain = toNumberArray(dict.getArray('Domain')); + var range = toNumberArray(dict.getArray('Range')); if (!domain) { error('No domain.'); } @@ -42933,8 +42942,8 @@ case 'AlternateCS': var numComps = IR[1]; var alt = IR[2]; - var tintFnIR = IR[3]; - return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR)); + var tintFn = IR[3]; + return new AlternateCS(numComps, ColorSpace.fromIR(alt), tintFn); case 'LabCS': whitePoint = IR[1]; blackPoint = IR[2]; @@ -43072,12 +43081,12 @@ numComps = name.length; } alt = ColorSpace.parseToIR(cs[2], xref, res); - var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3])); + var tintFn = PDFFunction.parse(xref, xref.fetchIfRef(cs[3])); return [ 'AlternateCS', numComps, alt, - tintFnIR + tintFn ]; case 'Lab': params = xref.fetchIfRef(cs[1]); @@ -52488,4 +52497,4 @@ })); }.call(pdfjsLibs)); exports.WorkerMessageHandler = pdfjsLibs.pdfjsCoreWorker.WorkerMessageHandler; -}));
\ No newline at end of file +})); diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index af200147f..b8aee0f14 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in @@ -61,10 +61,10 @@ STUB_HOOK = $(NSINSTALL) -D '$(ABS_DIST)/$(PKG_INST_PATH)'; \ $(NULL) endif -SEARCHPLUGINS_FILENAMES := $(shell $(call py_action,output_searchplugins_list,$(srcdir)/search/list.json $(AB_CD))) +SEARCHPLUGINS_FILENAMES := $(or $(shell $(call py_action,output_searchplugins_list,$(srcdir)/search/list.json $(AB_CD))), $(error Missing search plugins)) SEARCHPLUGINS_PATH := .deps/generated_$(AB_CD) SEARCHPLUGINS_TARGET := libs searchplugins -SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_FILENAMES)),$(or $(wildcard $(srcdir)/searchplugins/$(plugin)),$(warning Missing searchplugin: $(plugin)))) +SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_FILENAMES)),$(or $(wildcard $(srcdir)/searchplugins/$(plugin)),$(error Missing searchplugin: $(plugin)))) # Some locale-specific search plugins may have preprocessor directives, but the # default en-US ones do not. SEARCHPLUGINS_FLAGS := --silence-missing-directive-warnings diff --git a/config/external/icu/data/icudt58l.dat b/config/external/icu/data/icudt58l.dat Binary files differindex d981febb1..946a2c868 100644 --- a/config/external/icu/data/icudt58l.dat +++ b/config/external/icu/data/icudt58l.dat diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 9ced64c0d..8b9808aa3 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -183,6 +183,12 @@ Element::DoGetClasses() const NS_IMETHODIMP Element::QueryInterface(REFNSIID aIID, void** aInstancePtr) { + if (aIID.Equals(NS_GET_IID(Element))) { + NS_ADDREF_THIS(); + *aInstancePtr = this; + return NS_OK; + } + NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!"); nsresult rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr); diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 79f6cff51..b22a0d4ff 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -1937,7 +1937,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_INTERFACE_MAP_BEGIN(FragmentOrElement) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement) - NS_INTERFACE_MAP_ENTRY(Element) NS_INTERFACE_MAP_ENTRY(nsIContent) NS_INTERFACE_MAP_ENTRY(nsINode) NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp index 0d5815edb..b183bf387 100644 --- a/dom/cache/Cache.cpp +++ b/dom/cache/Cache.cpp @@ -618,7 +618,7 @@ Cache::AddAll(const GlobalObject& aGlobal, new FetchHandler(mActor->GetWorkerHolder(), this, Move(aRequestList), promise); - RefPtr<Promise> fetchPromise = Promise::All(aGlobal, fetchList, aRv); + RefPtr<Promise> fetchPromise = Promise::All(aGlobal.Context(), fetchList, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 73621df22..286f1d851 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -3224,11 +3224,15 @@ PPrintingParent* ContentParent::AllocPPrintingParent() { #ifdef NS_PRINTING - MOZ_ASSERT(!mPrintingParent, - "Only one PrintingParent should be created per process."); + MOZ_RELEASE_ASSERT(!mPrintingParent, + "Only one PrintingParent should be created per process."); // Create the printing singleton for this process. mPrintingParent = new PrintingParent(); + + // Take another reference for IPDL code. + mPrintingParent.get()->AddRef(); + return mPrintingParent.get(); #else MOZ_ASSERT_UNREACHABLE("Should never be created if no printing."); @@ -3240,8 +3244,11 @@ bool ContentParent::DeallocPPrintingParent(PPrintingParent* printing) { #ifdef NS_PRINTING - MOZ_ASSERT(mPrintingParent == printing, - "Only one PrintingParent should have been created per process."); + MOZ_RELEASE_ASSERT(mPrintingParent == printing, + "Only one PrintingParent should have been created per process."); + + // Release reference taken for IPDL code. + static_cast<PrintingParent*>(printing)->Release(); mPrintingParent = nullptr; #else diff --git a/dom/media/AudioConverter.cpp b/dom/media/AudioConverter.cpp index 77ad46ec6..25b981f43 100644 --- a/dom/media/AudioConverter.cpp +++ b/dom/media/AudioConverter.cpp @@ -362,15 +362,13 @@ size_t AudioConverter::ResampleRecipientFrames(size_t aFrames) const { if (!aFrames && mIn.Rate() != mOut.Rate()) { - // The resampler will be drained, account for frames currently buffered - // in the resampler. if (!mResampler) { return 0; } - return speex_resampler_get_output_latency(mResampler); - } else { - return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1; + // We drain by pushing in get_input_latency() samples of 0 + aFrames = speex_resampler_get_input_latency(mResampler); } + return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1; } size_t diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 94cafa029..e2934cbb2 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -1715,6 +1715,10 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG) RefPtr<GraphDriver> driver = CurrentDriver(); MonitorAutoUnlock unlock(mMonitor); driver->Start(); + // It's not safe to Shutdown() a thread from StableState, and + // releasing this may shutdown a SystemClockDriver thread. + // Proxy the release to outside of StableState. + NS_ReleaseOnMainThread(driver.forget(), true); // always proxy } } diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index 00b78143e..557f3a1f9 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -561,37 +561,40 @@ Promise::Reject(nsIGlobalObject* aGlobal, JSContext* aCx, // static already_AddRefed<Promise> -Promise::All(const GlobalObject& aGlobal, +Promise::All(JSContext* aCx, const nsTArray<RefPtr<Promise>>& aPromiseList, ErrorResult& aRv) { - nsCOMPtr<nsIGlobalObject> global; - global = do_QueryInterface(aGlobal.GetAsSupports()); - if (!global) { + JS::Rooted<JSObject*> globalObj(aCx, JS::CurrentGlobalOrNull(aCx)); + if (!globalObj) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } - JSContext* cx = aGlobal.Context(); + nsCOMPtr<nsIGlobalObject> global = xpc::NativeGlobal(globalObj); + if (!global) { + aRv.Throw(NS_ERROR_UNEXPECTED); + return nullptr; + } - JS::AutoObjectVector promises(cx); + JS::AutoObjectVector promises(aCx); if (!promises.reserve(aPromiseList.Length())) { - aRv.NoteJSContextException(cx); + aRv.NoteJSContextException(aCx); return nullptr; } for (auto& promise : aPromiseList) { - JS::Rooted<JSObject*> promiseObj(cx, promise->PromiseObj()); + JS::Rooted<JSObject*> promiseObj(aCx, promise->PromiseObj()); // Just in case, make sure these are all in the context compartment. - if (!JS_WrapObject(cx, &promiseObj)) { - aRv.NoteJSContextException(cx); + if (!JS_WrapObject(aCx, &promiseObj)) { + aRv.NoteJSContextException(aCx); return nullptr; } promises.infallibleAppend(promiseObj); } - JS::Rooted<JSObject*> result(cx, JS::GetWaitForAllPromise(cx, promises)); + JS::Rooted<JSObject*> result(aCx, JS::GetWaitForAllPromise(aCx, promises)); if (!result) { - aRv.NoteJSContextException(cx); + aRv.NoteJSContextException(aCx); return nullptr; } diff --git a/dom/promise/Promise.h b/dom/promise/Promise.h index f2ad3bd6c..642603a11 100644 --- a/dom/promise/Promise.h +++ b/dom/promise/Promise.h @@ -188,23 +188,26 @@ public: WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aWrapper); - // Do the equivalent of Promise.resolve in the current compartment of aCx. - // Errorrs are reported on the ErrorResult; if aRv comes back !Failed(), this - // function MUST return a non-null value. + // Do the equivalent of Promise.resolve in the compartment of aGlobal. The + // compartment of aCx is ignored. Errors are reported on the ErrorResult; if + // aRv comes back !Failed(), this function MUST return a non-null value. static already_AddRefed<Promise> Resolve(nsIGlobalObject* aGlobal, JSContext* aCx, JS::Handle<JS::Value> aValue, ErrorResult& aRv); - // Do the equivalent of Promise.reject in the current compartment of aCx. - // Errorrs are reported on the ErrorResult; if aRv comes back !Failed(), this - // function MUST return a non-null value. + // Do the equivalent of Promise.reject in the compartment of aGlobal. The + // compartment of aCx is ignored. Errors are reported on the ErrorResult; if + // aRv comes back !Failed(), this function MUST return a non-null value. static already_AddRefed<Promise> Reject(nsIGlobalObject* aGlobal, JSContext* aCx, JS::Handle<JS::Value> aValue, ErrorResult& aRv); + // Do the equivalent of Promise.all in the current compartment of aCx. Errors + // are reported on the ErrorResult; if aRv comes back !Failed(), this function + // MUST return a non-null value. static already_AddRefed<Promise> - All(const GlobalObject& aGlobal, - const nsTArray<RefPtr<Promise>>& aPromiseList, ErrorResult& aRv); + All(JSContext* aCx, const nsTArray<RefPtr<Promise>>& aPromiseList, + ErrorResult& aRv); void Then(JSContext* aCx, diff --git a/dom/svg/SVGClipPathElement.cpp b/dom/svg/SVGClipPathElement.cpp index 60d72fdf0..682d1271e 100644 --- a/dom/svg/SVGClipPathElement.cpp +++ b/dom/svg/SVGClipPathElement.cpp @@ -50,6 +50,13 @@ SVGClipPathElement::GetEnumInfo() ArrayLength(sEnumInfo)); } +bool +SVGClipPathElement::IsUnitsObjectBoundingBox() const +{ + return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; +} + + //---------------------------------------------------------------------- // nsIDOMNode methods diff --git a/dom/svg/SVGClipPathElement.h b/dom/svg/SVGClipPathElement.h index d84f5b30f..2d9f4c15e 100644 --- a/dom/svg/SVGClipPathElement.h +++ b/dom/svg/SVGClipPathElement.h @@ -36,6 +36,10 @@ public: // WebIDL already_AddRefed<SVGAnimatedEnumeration> ClipPathUnits(); + // This is an internal method that does not flush style, and thus + // the answer may be out of date if there's a pending style flush. + bool IsUnitsObjectBoundingBox() const; + protected: enum { CLIPPATHUNITS }; diff --git a/dom/svg/SVGTextContentElement.h b/dom/svg/SVGTextContentElement.h index 905468228..5f126c811 100644 --- a/dom/svg/SVGTextContentElement.h +++ b/dom/svg/SVGTextContentElement.h @@ -29,6 +29,7 @@ typedef SVGGraphicsElement SVGTextContentElementBase; class SVGTextContentElement : public SVGTextContentElementBase { + friend class ::SVGTextFrame; public: using FragmentOrElement::TextLength; diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp index 09b09a24b..780b2f5f8 100644 --- a/dom/workers/ServiceWorkerEvents.cpp +++ b/dom/workers/ServiceWorkerEvents.cpp @@ -948,10 +948,8 @@ ExtendableEvent::GetPromise() } JSContext* cx = jsapi.cx(); - GlobalObject global(cx, globalObj->GetGlobalJSObject()); - ErrorResult result; - RefPtr<Promise> p = Promise::All(global, Move(mPromises), result); + RefPtr<Promise> p = Promise::All(cx, Move(mPromises), result); if (NS_WARN_IF(result.MaybeSetPendingException(cx))) { return nullptr; } diff --git a/gfx/2d/FilterNodeSoftware.cpp b/gfx/2d/FilterNodeSoftware.cpp index 3abdb7a02..169694069 100644 --- a/gfx/2d/FilterNodeSoftware.cpp +++ b/gfx/2d/FilterNodeSoftware.cpp @@ -2796,7 +2796,7 @@ FilterNodeArithmeticCombineSoftware::SetAttribute(uint32_t aIndex, uint32_t aSize) { MOZ_ASSERT(aIndex == ATT_ARITHMETIC_COMBINE_COEFFICIENTS); - MOZ_ASSERT(aSize == 4); + MOZ_RELEASE_ASSERT(aSize == 4); mK1 = aFloat[0]; mK2 = aFloat[1]; diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index c91d558af..65678432d 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -149,6 +149,9 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion &uploadSize, needInit, aFrom); + if (mTextureFormat == SurfaceFormat::UNKNOWN) { + return false; + } if (uploadSize > 0) { UpdateUploadSize(uploadSize); diff --git a/gfx/gl/GLUploadHelpers.cpp b/gfx/gl/GLUploadHelpers.cpp index 75165eedf..ca1c890a4 100644 --- a/gfx/gl/GLUploadHelpers.cpp +++ b/gfx/gl/GLUploadHelpers.cpp @@ -27,6 +27,23 @@ DataOffset(const IntPoint& aPoint, int32_t aStride, SurfaceFormat aFormat) return data; } +static bool +CheckUploadBounds(const IntSize& aDst, const IntSize& aSrc, const IntPoint& aOffset) +{ + if (aOffset.x < 0 || aOffset.y < 0 || + aOffset.x >= aSrc.width || + aOffset.y >= aSrc.height) { + MOZ_ASSERT_UNREACHABLE("Offset outside source bounds"); + return false; + } + if (aDst.width > (aSrc.width - aOffset.x) || + aDst.height > (aSrc.height - aOffset.y)) { + MOZ_ASSERT_UNREACHABLE("Source has insufficient data"); + return false; + } + return true; +} + static GLint GetAddressAlignment(ptrdiff_t aAddress) { if (!(aAddress & 0x7)) { @@ -375,6 +392,7 @@ TexImage2DHelper(GLContext* gl, SurfaceFormat UploadImageDataToTexture(GLContext* gl, unsigned char* aData, + const gfx::IntSize& aDataSize, int32_t aStride, SurfaceFormat aFormat, const nsIntRegion& aDstRegion, @@ -498,6 +516,10 @@ UploadImageDataToTexture(GLContext* gl, // Upload each rect in the region to the texture for (auto iter = aDstRegion.RectIter(); !iter.Done(); iter.Next()) { const IntRect& rect = iter.Get(); + if (!CheckUploadBounds(rect.Size(), aDataSize, rect.TopLeft())) { + return SurfaceFormat::UNKNOWN; + } + const unsigned char* rectData = aData + DataOffset(rect.TopLeft(), aStride, aFormat); @@ -534,10 +556,17 @@ UploadSurfaceToTexture(GLContext* gl, int32_t stride = aSurface->Stride(); SurfaceFormat format = aSurface->GetFormat(); + gfx::IntSize size = aSurface->GetSize(); + if (!CheckUploadBounds(aSize, size, aSrcPoint)) { + return SurfaceFormat::UNKNOWN; + } + unsigned char* data = aSurface->GetData() + DataOffset(aSrcPoint, stride, format); + size.width -= aSrcPoint.x; + size.height -= aSrcPoint.y; - return UploadImageDataToTexture(gl, data, stride, format, + return UploadImageDataToTexture(gl, data, size, stride, format, aDstRegion, aTexture, aSize, aOutUploadSize, aNeedInit, aTextureUnit, aTextureTarget); diff --git a/gfx/gl/GLUploadHelpers.h b/gfx/gl/GLUploadHelpers.h index 866d44adb..f732d2b38 100644 --- a/gfx/gl/GLUploadHelpers.h +++ b/gfx/gl/GLUploadHelpers.h @@ -28,6 +28,7 @@ class GLContext; * \param gl The GL Context to use. * \param aData Start of image data of surface to upload. * Corresponds to the first pixel of the texture. + * \param aDataSize The image data's size. * \param aStride The image data's stride. * \param aFormat The image data's format. * \param aDstRegion Region of the texture to upload. @@ -46,6 +47,7 @@ class GLContext; gfx::SurfaceFormat UploadImageDataToTexture(GLContext* gl, unsigned char* aData, + const gfx::IntSize& aDataSize, int32_t aStride, gfx::SurfaceFormat aFormat, const nsIntRegion& aDstRegion, diff --git a/gfx/gl/TextureImageEGL.cpp b/gfx/gl/TextureImageEGL.cpp index 87a547c26..3bb2987d1 100644 --- a/gfx/gl/TextureImageEGL.cpp +++ b/gfx/gl/TextureImageEGL.cpp @@ -119,6 +119,10 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& &uploadSize, needInit, aFrom); + if (mTextureFormat == SurfaceFormat::UNKNOWN) { + return false; + } + if (uploadSize > 0) { UpdateUploadSize(uploadSize); } diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index e7d87e238..c93037384 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -888,8 +888,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion) mFirstSource = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::RGB_FROM_YCBCR); mFirstSource->SetOwner(this); } - mFirstSource->Update(surf, aRegion); - return true; + return mFirstSource->Update(surf, aRegion); } RefPtr<DataTextureSource> srcY; diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 02c398b51..ec6ba9131 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -161,9 +161,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface, } } - mTexImage->UpdateFromDataSource(aSurface, aDestRegion, aSrcOffset); - - return true; + return mTexImage->UpdateFromDataSource(aSurface, aDestRegion, aSrcOffset); } void diff --git a/gfx/skia/skia/include/core/SkTypes.h b/gfx/skia/skia/include/core/SkTypes.h index 0cef8a125..f45c3c2b7 100644 --- a/gfx/skia/skia/include/core/SkTypes.h +++ b/gfx/skia/skia/include/core/SkTypes.h @@ -109,6 +109,11 @@ SK_API extern void* sk_calloc(size_t size); */ SK_API extern void* sk_calloc_throw(size_t size); +// Performs a safe multiply count * elemSize, checking for overflow +SK_API extern void* sk_calloc_throw(size_t count, size_t elemSize); +SK_API extern void* sk_malloc_throw(size_t count, size_t elemSize); +SK_API extern void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize); + // bzero is safer than memset, but we can't rely on it, so... sk_bzero() static inline void sk_bzero(void* buffer, size_t size) { // Please c.f. sk_careful_memcpy. It's undefined behavior to call memset(null, 0, 0). @@ -295,6 +300,7 @@ template <typename D, typename S> D SkTo(S s) { #define SK_MaxU32 0xFFFFFFFF #define SK_MinU32 0 #define SK_NaN32 ((int) (1U << 31)) +#define SK_MaxSizeT SIZE_MAX /** Returns true if the value can be represented with signed 16bits */ diff --git a/gfx/skia/skia/include/private/SkTDArray.h b/gfx/skia/skia/include/private/SkTDArray.h index f71d35700..a46a05e9d 100644 --- a/gfx/skia/skia/include/private/SkTDArray.h +++ b/gfx/skia/skia/include/private/SkTDArray.h @@ -21,7 +21,7 @@ public: fReserve = fCount = 0; fArray = NULL; if (count) { - fArray = (T*)sk_malloc_throw(count * sizeof(T)); + fArray = (T*)sk_malloc_throw(count, sizeof(T)); memcpy(fArray, src, sizeof(T) * count); fReserve = fCount = count; } @@ -346,7 +346,7 @@ public: void shrinkToFit() { fReserve = fCount; - fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T)); + fArray = (T*)sk_realloc_throw(fArray, fReserve, sizeof(T)); } private: @@ -359,6 +359,7 @@ private: * This is the same as calling setCount(count() + delta). */ void adjustCount(int delta) { + SkASSERT_RELEASE(fCount <= std::numeric_limits<int>::max() - delta); this->setCount(fCount + delta); } @@ -372,9 +373,10 @@ private: */ void resizeStorageToAtLeast(int count) { SkASSERT(count > fReserve); + SkASSERT_RELEASE(count <= std::numeric_limits<int>::max() - std::numeric_limits<int>::max() / 5 - 4); fReserve = count + 4; fReserve += fReserve / 4; - fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T)); + fArray = (T*)sk_realloc_throw(fArray, fReserve, sizeof(T)); } }; diff --git a/gfx/skia/skia/src/core/SkMallocPixelRef.cpp b/gfx/skia/skia/src/core/SkMallocPixelRef.cpp index fffc04484..8db704fa4 100644 --- a/gfx/skia/skia/src/core/SkMallocPixelRef.cpp +++ b/gfx/skia/skia/src/core/SkMallocPixelRef.cpp @@ -8,8 +8,21 @@ #include "SkMallocPixelRef.h" #include "SkBitmap.h" #include "SkReadBuffer.h" +#include "SkSafeMath.h" #include "SkWriteBuffer.h" +void* sk_calloc_throw(size_t count, size_t elemSize) { + return sk_calloc_throw(SkSafeMath::Mul(count, elemSize)); +} + +void* sk_malloc_throw(size_t count, size_t elemSize) { + return sk_malloc_throw(SkSafeMath::Mul(count, elemSize)); +} + +void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize) { + return sk_realloc_throw(buffer, SkSafeMath::Mul(count, elemSize)); +} + // assumes ptr was allocated via sk_malloc static void sk_free_releaseproc(void* ptr, void*) { sk_free(ptr); diff --git a/gfx/skia/skia/src/core/SkMath.cpp b/gfx/skia/skia/src/core/SkMath.cpp index 6eff790c8..84796c522 100644 --- a/gfx/skia/skia/src/core/SkMath.cpp +++ b/gfx/skia/skia/src/core/SkMath.cpp @@ -84,3 +84,18 @@ float SkScalarSinCos(float radians, float* cosValue) { } return sinValue; } + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +size_t SkSafeMath::Add(size_t x, size_t y) { + SkSafeMath tmp; + size_t sum = tmp.add(x, y); + return tmp.ok() ? sum : SK_MaxSizeT; +} + +size_t SkSafeMath::Mul(size_t x, size_t y) { + SkSafeMath tmp; + size_t prod = tmp.mul(x, y); + return tmp.ok() ? prod : SK_MaxSizeT; +} + diff --git a/gfx/skia/skia/src/core/SkSafeMath.h b/gfx/skia/skia/src/core/SkSafeMath.h new file mode 100644 index 000000000..0bc0fbfac --- /dev/null +++ b/gfx/skia/skia/src/core/SkSafeMath.h @@ -0,0 +1,106 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkSafeMath_DEFINED +#define SkSafeMath_DEFINED + +#include "SkTypes.h" + +// SkSafeMath always check that a series of operations do not overflow. +// This must be correct for all platforms, because this is a check for safety at runtime. + +class SkSafeMath { +public: + SkSafeMath() = default; + + bool ok() const { return fOK; } + explicit operator bool() const { return fOK; } + + size_t mul(size_t x, size_t y) { + return sizeof(size_t) == sizeof(uint64_t) ? mul64(x, y) : mul32(x, y); + } + + size_t add(size_t x, size_t y) { + size_t result = x + y; + fOK &= result >= x; + return result; + } + + /** + * Return a + b, unless this result is an overflow/underflow. In those cases, fOK will + * be set to false, and it is undefined what this returns. + */ + int addInt(int a, int b) { + if (b < 0 && a < std::numeric_limits<int>::min() - b) { + fOK = false; + return a; + } else if (b > 0 && a > std::numeric_limits<int>::max() - b) { + fOK = false; + return a; + } + return a + b; + } + + size_t alignUp(size_t x, size_t alignment) { + SkASSERT(alignment && !(alignment & (alignment - 1))); + return add(x, alignment - 1) & ~(alignment - 1); + } + + template <typename T> T castTo(size_t value) { + if (!SkTFitsIn<T>(value)) { + fOK = false; + } + return static_cast<T>(value); + } + + // These saturate to their results + static size_t Add(size_t x, size_t y); + static size_t Mul(size_t x, size_t y); + static size_t Align4(size_t x) { + SkSafeMath safe; + return safe.alignUp(x, 4); + } + +private: + uint32_t mul32(uint32_t x, uint32_t y) { + uint64_t bx = x; + uint64_t by = y; + uint64_t result = bx * by; + fOK &= result >> 32 == 0; + return result; + } + + uint64_t mul64(uint64_t x, uint64_t y) { + if (x <= std::numeric_limits<uint64_t>::max() >> 32 + && y <= std::numeric_limits<uint64_t>::max() >> 32) { + return x * y; + } else { + auto hi = [](uint64_t x) { return x >> 32; }; + auto lo = [](uint64_t x) { return x & 0xFFFFFFFF; }; + + uint64_t lx_ly = lo(x) * lo(y); + uint64_t hx_ly = hi(x) * lo(y); + uint64_t lx_hy = lo(x) * hi(y); + uint64_t hx_hy = hi(x) * hi(y); + uint64_t result = 0; + result = this->add(lx_ly, (hx_ly << 32)); + result = this->add(result, (lx_hy << 32)); + fOK &= (hx_hy + (hx_ly >> 32) + (lx_hy >> 32)) == 0; + + #if defined(SK_DEBUG) && defined(__clang__) && defined(__x86_64__) + auto double_check = (unsigned __int128)x * y; + SkASSERT(result == (double_check & 0xFFFFFFFFFFFFFFFF)); + SkASSERT(!fOK || (double_check >> 64 == 0)); + #endif + + return result; + } + } + bool fOK = true; +}; + +#endif//SkSafeMath_DEFINED diff --git a/image/Downscaler.cpp b/image/Downscaler.cpp index 18f09c596..2ded487a5 100644 --- a/image/Downscaler.cpp +++ b/image/Downscaler.cpp @@ -231,6 +231,7 @@ Downscaler::CommitRow() int32_t inLineToRead = filterOffset + mLinesInBuffer; MOZ_ASSERT(mCurrentInLine <= inLineToRead, "Reading past end of input"); if (mCurrentInLine == inLineToRead) { + MOZ_RELEASE_ASSERT(mLinesInBuffer < mWindowCapacity, "Need more rows than capacity!"); skia::ConvolveHorizontally(mRowBuffer.get(), *mXFilter, mWindow[mLinesInBuffer++], mHasAlpha, supports_sse2() || supports_mmi()); @@ -239,7 +240,7 @@ Downscaler::CommitRow() MOZ_ASSERT(mCurrentOutLine < mTargetSize.height, "Writing past end of output"); - while (mLinesInBuffer == filterLength) { + while (mLinesInBuffer >= filterLength) { DownscaleInputLine(); if (mCurrentOutLine == mTargetSize.height) { @@ -340,9 +341,14 @@ Downscaler::DownscaleInputLine() // Shift the buffer. We're just moving pointers here, so this is cheap. mLinesInBuffer -= diff; - mLinesInBuffer = max(mLinesInBuffer, 0); - for (int32_t i = 0; i < mLinesInBuffer; ++i) { - swap(mWindow[i], mWindow[filterLength - mLinesInBuffer + i]); + mLinesInBuffer = min(max(mLinesInBuffer, 0), mWindowCapacity); + + // If we already have enough rows to satisfy the filter, there is no need + // to swap as we won't be writing more before the next convolution. + if (filterLength > mLinesInBuffer) { + for (int32_t i = 0; i < mLinesInBuffer; ++i) { + swap(mWindow[i], mWindow[filterLength - mLinesInBuffer + i]); + } } } diff --git a/image/DownscalingFilter.h b/image/DownscalingFilter.h index 6b0d3b26b..1485b85c2 100644 --- a/image/DownscalingFilter.h +++ b/image/DownscalingFilter.h @@ -246,6 +246,7 @@ protected: int32_t inputRowToRead = filterOffset + mRowsInWindow; MOZ_ASSERT(mInputRow <= inputRowToRead, "Reading past end of input"); if (mInputRow == inputRowToRead) { + MOZ_RELEASE_ASSERT(mRowsInWindow < mWindowCapacity, "Need more rows than capacity!"); skia::ConvolveHorizontally(mRowBuffer.get(), *mXFilter, mWindow[mRowsInWindow++], mHasAlpha, supports_sse2() || supports_mmi()); @@ -254,7 +255,7 @@ protected: MOZ_ASSERT(mOutputRow < mNext.InputSize().height, "Writing past end of output"); - while (mRowsInWindow == filterLength) { + while (mRowsInWindow >= filterLength) { DownscaleInputRow(); if (mOutputRow == mNext.InputSize().height) { @@ -330,9 +331,14 @@ private: // Shift the buffer. We're just moving pointers here, so this is cheap. mRowsInWindow -= diff; - mRowsInWindow = std::max(mRowsInWindow, 0); - for (int32_t i = 0; i < mRowsInWindow; ++i) { - std::swap(mWindow[i], mWindow[filterLength - mRowsInWindow + i]); + mRowsInWindow = std::min(std::max(mRowsInWindow, 0), mWindowCapacity); + + // If we already have enough rows to satisfy the filter, there is no need + // to swap as we won't be writing more before the next convolution. + if (filterLength > mRowsInWindow) { + for (int32_t i = 0; i < mRowsInWindow; ++i) { + std::swap(mWindow[i], mWindow[filterLength - mRowsInWindow + i]); + } } } diff --git a/intl/tzdata/SVN-INFO b/intl/tzdata/SVN-INFO index 9d39d5a36..fba30f87c 100644 --- a/intl/tzdata/SVN-INFO +++ b/intl/tzdata/SVN-INFO @@ -1,10 +1,10 @@ Path: 44 -URL: https://ssl.icu-project.org/repos/icu/data/trunk/tzdata/icunew/2018c/44 -Relative URL: ^/data/trunk/tzdata/icunew/2018c/44 +URL: https://ssl.icu-project.org/repos/icu/data/trunk/tzdata/icunew/2018d/44 +Relative URL: ^/data/trunk/tzdata/icunew/2018d/44 Repository Root: https://ssl.icu-project.org/repos/icu Repository UUID: 251d0590-4201-4cf1-90de-194747b24ca1 Node Kind: directory Last Changed Author: yoshito -Last Changed Rev: 40799 -Last Changed Date: 2018-01-24 03:22:47 +0000 (Mi, 24 Jan 2018) +Last Changed Rev: 41166 +Last Changed Date: 2018-03-28 13:41:38 +0000 diff --git a/intl/tzdata/source/be/metaZones.res b/intl/tzdata/source/be/metaZones.res Binary files differindex f1d6596fc..68d92ec3b 100644 --- a/intl/tzdata/source/be/metaZones.res +++ b/intl/tzdata/source/be/metaZones.res diff --git a/intl/tzdata/source/be/windowsZones.res b/intl/tzdata/source/be/windowsZones.res Binary files differindex 0b23180a7..356411c0f 100644 --- a/intl/tzdata/source/be/windowsZones.res +++ b/intl/tzdata/source/be/windowsZones.res diff --git a/intl/tzdata/source/be/zoneinfo64.res b/intl/tzdata/source/be/zoneinfo64.res Binary files differindex 94f369bf6..2edd8942e 100644 --- a/intl/tzdata/source/be/zoneinfo64.res +++ b/intl/tzdata/source/be/zoneinfo64.res diff --git a/intl/tzdata/source/ee/metaZones.res b/intl/tzdata/source/ee/metaZones.res Binary files differindex 7ff159e44..349853711 100644 --- a/intl/tzdata/source/ee/metaZones.res +++ b/intl/tzdata/source/ee/metaZones.res diff --git a/intl/tzdata/source/ee/windowsZones.res b/intl/tzdata/source/ee/windowsZones.res Binary files differindex 0009b5552..56f1b19ec 100644 --- a/intl/tzdata/source/ee/windowsZones.res +++ b/intl/tzdata/source/ee/windowsZones.res diff --git a/intl/tzdata/source/ee/zoneinfo64.res b/intl/tzdata/source/ee/zoneinfo64.res Binary files differindex a67e937e6..144ff1530 100644 --- a/intl/tzdata/source/ee/zoneinfo64.res +++ b/intl/tzdata/source/ee/zoneinfo64.res diff --git a/intl/tzdata/source/le/metaZones.res b/intl/tzdata/source/le/metaZones.res Binary files differindex c3c4129e5..c7fd90cee 100644 --- a/intl/tzdata/source/le/metaZones.res +++ b/intl/tzdata/source/le/metaZones.res diff --git a/intl/tzdata/source/le/windowsZones.res b/intl/tzdata/source/le/windowsZones.res Binary files differindex 584bd798e..2409ae877 100644 --- a/intl/tzdata/source/le/windowsZones.res +++ b/intl/tzdata/source/le/windowsZones.res diff --git a/intl/tzdata/source/le/zoneinfo64.res b/intl/tzdata/source/le/zoneinfo64.res Binary files differindex c3c7b22b7..60d2ac03a 100644 --- a/intl/tzdata/source/le/zoneinfo64.res +++ b/intl/tzdata/source/le/zoneinfo64.res diff --git a/intl/tzdata/source/metaZones.txt b/intl/tzdata/source/metaZones.txt index 564992a3b..a9c148a3a 100644 --- a/intl/tzdata/source/metaZones.txt +++ b/intl/tzdata/source/metaZones.txt @@ -131,11 +131,11 @@ metaZones:table(nofallback){ 001{"America/Halifax"} AG{"America/Antigua"} AI{"America/Anguilla"} - AN{"America/Curacao"} AW{"America/Aruba"} BB{"America/Barbados"} BM{"Atlantic/Bermuda"} BQ{"America/Kralendijk"} + CW{"America/Curacao"} DM{"America/Dominica"} GD{"America/Grenada"} GL{"America/Thule"} @@ -2559,6 +2559,11 @@ metaZones:table(nofallback){ { "Casey", "2016-10-21 16:00", + "2016-03-10 17:00", + } + { + "Australia_Western", + "2018-03-10 17:00", "9999-12-31 23:59", } } diff --git a/intl/tzdata/source/windowsZones.txt b/intl/tzdata/source/windowsZones.txt index d7f143cf8..6428c54e8 100644 --- a/intl/tzdata/source/windowsZones.txt +++ b/intl/tzdata/source/windowsZones.txt @@ -156,7 +156,6 @@ windowsZones:table(nofallback){ } "Central Pacific Standard Time"{ 001{"Pacific/Guadalcanal"} - AQ{"Antarctica/Casey"} AU{"Antarctica/Macquarie"} FM{"Pacific/Ponape Pacific/Kosrae"} NC{"Pacific/Noumea"} @@ -212,7 +211,6 @@ windowsZones:table(nofallback){ KE{"Africa/Nairobi"} KM{"Indian/Comoro"} MG{"Indian/Antananarivo"} - SD{"Africa/Khartoum"} SO{"Africa/Mogadishu"} SS{"Africa/Juba"} TZ{"Africa/Dar_es_Salaam"} @@ -614,6 +612,10 @@ windowsZones:table(nofallback){ 001{"Asia/Colombo"} LK{"Asia/Colombo"} } + "Sudan Standard Time"{ + 001{"Africa/Khartoum"} + SD{"Africa/Khartoum"} + } "Syria Standard Time"{ 001{"Asia/Damascus"} SY{"Asia/Damascus"} @@ -728,6 +730,7 @@ windowsZones:table(nofallback){ } "W. Australia Standard Time"{ 001{"Australia/Perth"} + AQ{"Antarctica/Casey"} AU{"Australia/Perth"} } "W. Central Africa Standard Time"{ diff --git a/intl/tzdata/source/zoneinfo64.txt b/intl/tzdata/source/zoneinfo64.txt index 8eed0199d..30fab0972 100644 --- a/intl/tzdata/source/zoneinfo64.txt +++ b/intl/tzdata/source/zoneinfo64.txt @@ -3,17 +3,17 @@ // License & terms of use: http://www.unicode.org/copyright.html#License //--------------------------------------------------------- // Build tool: tz2icu -// Build date: Tue Jan 23 20:51:55 2018 +// Build date: Wed Mar 28 09:18:39 2018 // tz database: ftp://ftp.iana.org/tz/ -// tz version: 2018c -// ICU version: 60.1 +// tz version: 2018d +// ICU version: 61.1 //--------------------------------------------------------- // >> !!! >> THIS IS A MACHINE-GENERATED FILE << !!! << // >> !!! >>> DO NOT EDIT <<< !!! << //--------------------------------------------------------- zoneinfo64:table(nofallback) { - TZVersion { "2018c" } + TZVersion { "2018d" } Zones:array { /* ACT */ :int { 354 } //Z#0 /* AET */ :int { 366 } //Z#1 @@ -44,7 +44,7 @@ zoneinfo64:table(nofallback) { /* Africa/Bangui */ :int { 36 } //Z#12 /* Africa/Banjul */ :int { 5 } //Z#13 /* Africa/Bissau */ :table { - trans:intvector { -1830380260, 157770000 } + trans:intvector { -1830380400, 157770000 } typeOffsets:intvector { -3740, 0, -3600, 0, 0, 0 } typeMap:bin { "0102" } } //Z#14 @@ -156,7 +156,7 @@ zoneinfo64:table(nofallback) { /* Africa/Porto-Novo */ :int { 36 } //Z#53 /* Africa/Sao_Tome */ :table { transPre32:intvector { -1, 1581055280 } - trans:intvector { -1830381795, 1514768400 } + trans:intvector { -1830384000, 1514768400 } typeOffsets:intvector { 1616, 0, -2205, 0, 0, 0, 3600, 0 } typeMap:bin { "010203" } } //Z#54 @@ -534,8 +534,8 @@ zoneinfo64:table(nofallback) { } //Z#121 /* America/Grand_Turk */ :table { transPre32:intvector { -1, 1770462768 } - trans:intvector { -1827687169, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600, 452070000, 467791200, 483519600, 499240800, 514969200, 530690400, 544604400, 562140000, 576054000, 594194400, 607503600, 625644000, 638953200, 657093600, 671007600, 688543200, 702457200, 719992800, 733906800, 752047200, 765356400, 783496800, 796806000, 814946400, 828860400, 846396000, 860310000, 877845600, 891759600, 909295200, 923209200, 941349600, 954658800, 972799200, 986108400, 1004248800, 1018162800, 1035698400, 1049612400, 1067148000, 1081062000, 1099202400, 1112511600, 1130652000, 1143961200, 1162101600, 1173596400, 1194156000, 1205046000, 1225605600, 1236495600, 1257055200, 1268550000, 1289109600, 1299999600, 1320559200, 1331449200, 1352008800, 1362898800, 1383458400, 1394348400, 1414908000, 1425798000, 1446357600, 1520751600, 1541311200 } - typeOffsets:intvector { -17072, 0, -18431, 0, -18000, 0, -18000, 3600, -14400, 0 } + trans:intvector { -1827687170, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600, 452070000, 467791200, 483519600, 499240800, 514969200, 530690400, 544604400, 562140000, 576054000, 594194400, 607503600, 625644000, 638953200, 657093600, 671007600, 688543200, 702457200, 719992800, 733906800, 752047200, 765356400, 783496800, 796806000, 814946400, 828860400, 846396000, 860310000, 877845600, 891759600, 909295200, 923209200, 941349600, 954658800, 972799200, 986108400, 1004248800, 1018162800, 1035698400, 1049612400, 1067148000, 1081062000, 1099202400, 1112511600, 1130652000, 1143961200, 1162101600, 1173596400, 1194156000, 1205046000, 1225605600, 1236495600, 1257055200, 1268550000, 1289109600, 1299999600, 1320559200, 1331449200, 1352008800, 1362898800, 1383458400, 1394348400, 1414908000, 1425798000, 1446357600, 1520751600, 1541311200 } + typeOffsets:intvector { -17072, 0, -18430, 0, -18000, 0, -18000, 3600, -14400, 0 } typeMap:bin { "010203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203040302" } finalRule { "US" } finalRaw:int { -18000 } @@ -675,8 +675,8 @@ zoneinfo64:table(nofallback) { finalYear:int { 2008 } } //Z#141 /* America/Jamaica */ :table { - trans:intvector { -1827687169, 126687600, 152085600, 162370800, 183535200, 199263600, 215589600, 230713200, 247039200, 262767600, 278488800, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600 } - typeOffsets:intvector { -18431, 0, -18000, 0, -18000, 3600 } + trans:intvector { -1827687170, 126687600, 152085600, 162370800, 183535200, 199263600, 215589600, 230713200, 247039200, 262767600, 278488800, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600 } + typeOffsets:intvector { -18430, 0, -18000, 0, -18000, 3600 } typeMap:bin { "010201020102010201020102010201020102010201" } links:intvector { 142, 528 } } //Z#142 @@ -836,9 +836,9 @@ zoneinfo64:table(nofallback) { finalYear:int { 2003 } } //Z#168 /* America/Montevideo */ :table { - trans:intvector { -1567455316, -1459542600, -1443819600, -1428006600, -1412283600, -1396470600, -1380747600, -1141590600, -1128286800, -1110141000, -1096837200, -1078691400, -1065387600, -1046637000, -1033938000, -1015187400, -1002488400, -983737800, -971038800, -952288200, -938984400, -920838600, -907534800, -896819400, -883602000, -853619400, -845848800, -334789200, -319672800, -314226000, -309996000, -149720400, -134604000, -118270800, -100044000, -86821200, -68508000, -50446800, -34119000, -18910800, -2583000, 12625200, 28953000, 72932400, 82692000, 132116400, 156911400, 212983200, 250052400, 260244000, 307594800, 325994400, 566449200, 574308000, 597812400, 605671200, 625633200, 636516000, 656478000, 667965600, 688532400, 699415200, 719377200, 730864800, 1095562800, 1111896000, 1128834000, 1142136000, 1159678800, 1173585600, 1191733200, 1205035200, 1223182800, 1236484800, 1254632400, 1268539200, 1286082000, 1299988800, 1317531600, 1331438400, 1349586000, 1362888000, 1381035600, 1394337600, 1412485200, 1425787200 } - typeOffsets:intvector { -13484, 0, -12600, 0, -12600, 1800, -10800, 0, -10800, 1800, -10800, 3600 } - typeMap:bin { "0102010201020102010201020102010201020102010201020105030503050305030503050304030403040305030405030503050305030503050305030503050305030503050305030503050305030503050305030503" } + trans:intvector { -1567455309, -1459627200, -1443819600, -1428006600, -1412283600, -1396470600, -1380747600, -1141590600, -1128286800, -1110141000, -1096837200, -1078691400, -1065387600, -1047241800, -1033938000, -1015187400, -1002488400, -983737800, -971038800, -954707400, -938984400, -920838600, -907534800, -896819400, -853621200, -845847000, -334789200, -319671000, -314226000, -309996000, -149720400, -134604000, -50446800, -34205400, 9860400, 14176800, 72846000, 80100000, 127278000, 132111000, 147234600, 156913200, 165376800, 219812400, 226461600, 250052400, 257911200, 282711600, 289360800, 294202800, 322020000, 566449200, 573012000, 597812400, 605066400, 625633200, 635911200, 656478000, 667965600, 688532400, 699415200, 719377200, 730864800, 1095562800, 1111896000, 1128834000, 1142136000, 1159678800, 1173585600, 1191733200, 1205035200, 1223182800, 1236484800, 1254632400, 1268539200, 1286082000, 1299988800, 1317531600, 1331438400, 1349586000, 1362888000, 1381035600, 1394337600, 1412485200, 1425787200 } + typeOffsets:intvector { -13491, 0, -14400, 0, -12600, 0, -12600, 1800, -10800, 0, -10800, 1800, -10800, 3600, -10800, 5400 } + typeMap:bin { "01030203020302030203020302030203020302030203020305040504060406040504060406040705040604060406040604060406040604060406040604060406040604060406040604060406040604060406040604" } } //Z#169 /* America/Montreal */ :int { 217 } //Z#170 /* America/Montserrat */ :int { 186 } //Z#171 @@ -1182,9 +1182,9 @@ zoneinfo64:table(nofallback) { finalYear:int { 2008 } } //Z#224 /* Antarctica/Casey */ :table { - trans:intvector { -31536000, 1255802400, 1267714800, 1319738400, 1329843600, 1477065600 } + trans:intvector { -31536000, 1255802400, 1267714800, 1319738400, 1329843600, 1477065600, 1520701200 } typeOffsets:intvector { 0, 0, 28800, 0, 39600, 0 } - typeMap:bin { "010201020102" } + typeMap:bin { "01020102010201" } } //Z#225 /* Antarctica/Davis */ :table { trans:intvector { -409190400, -163062000, -28857600, 1255806000, 1268251200, 1319742000, 1329854400 } @@ -1498,7 +1498,7 @@ zoneinfo64:table(nofallback) { /* Asia/Kuwait */ :int { 308 } //Z#290 /* Asia/Macao */ :int { 292 } //Z#291 /* Asia/Macau */ :table { - trans:intvector { -1830411260, -277360200, -257405400, -245910600, -225955800, -214473600, -194506200, -182406600, -163056600, -150969600, -131619600, -117088200, -101367000, -85638600, -69312600, -53584200, -37863000, -22134600, -6413400, 9315000, 25036200, 40764600, 56485800, 72201600, 87922800, 103651200, 119977200, 135705600, 151439400, 167167800, 182889000, 198617400, 214338600, 230067000, 245788200, 261504000, 277225200, 292953600, 309279600, 325008000, 340729200 } + trans:intvector { -1830412800, -277360200, -257405400, -245910600, -225955800, -214473600, -194506200, -182406600, -163056600, -150969600, -131619600, -117088200, -101367000, -85638600, -69312600, -53584200, -37863000, -22134600, -6413400, 9315000, 25036200, 40764600, 56485800, 72201600, 87922800, 103651200, 119977200, 135705600, 151439400, 167167800, 182889000, 198617400, 214338600, 230067000, 245788200, 261504000, 277225200, 292953600, 309279600, 325008000, 340729200 } typeOffsets:intvector { 27260, 0, 28800, 0, 28800, 3600 } typeMap:bin { "0102010201020102010201020102010201020102010201020102010201020102010201020102010201" } links:intvector { 291, 292 } @@ -1709,7 +1709,7 @@ zoneinfo64:table(nofallback) { } //Z#335 /* Atlantic/Azores */ :table { transPre32:intvector { -1, 1581063056 } - trans:intvector { -1830377128, -1689548400, -1677794400, -1667430000, -1647730800, -1635807600, -1616194800, -1604358000, -1584658800, -1572735600, -1553036400, -1541199600, -1521500400, -1442444400, -1426806000, -1379286000, -1364770800, -1348441200, -1333321200, -1316386800, -1301266800, -1284332400, -1269817200, -1221433200, -1206918000, -1191193200, -1175468400, -1127689200, -1111964400, -1096844400, -1080514800, -1063580400, -1049065200, -1033340400, -1017615600, -1002495600, -986166000, -969231600, -950482800, -942015600, -922662000, -906937200, -891126000, -877302000, -873676800, -864000000, -857948400, -845852400, -842832000, -831340800, -825894000, -814402800, -810777600, -799891200, -794444400, -782953200, -779328000, -768441600, -762994800, -749084400, -733359600, -717624000, -701899200, -686174400, -670449600, -654724800, -639000000, -591825600, -575496000, -559771200, -544046400, -528321600, -512596800, -496872000, -481147200, -465422400, -449697600, -433972800, -417643200, -401918400, -386193600, -370468800, -354744000, -339019200, -323294400, -307569600, -291844800, -276120000, -260395200, -244670400, -228340800, -212616000, -196891200, -181166400, -165441600, -149716800, -133992000, -118267200, 228272400, 243997200, 260326800, 276051600, 291776400, 307504800, 323226000, 338954400, 354679200, 370404000, 386128800, 401853600, 417582000, 433303200, 449028000, 465357600, 481082400, 496807200, 512532000, 528256800, 543981600, 559706400, 575431200, 591156000, 606880800, 622605600, 638330400, 654660000, 670384800, 686109600, 701834400, 717559200, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 } + trans:intvector { -1830376800, -1689548400, -1677794400, -1667430000, -1647730800, -1635807600, -1616194800, -1604358000, -1584658800, -1572735600, -1553036400, -1541199600, -1521500400, -1442444400, -1426806000, -1379286000, -1364770800, -1348441200, -1333321200, -1316386800, -1301266800, -1284332400, -1269817200, -1221433200, -1206918000, -1191193200, -1175468400, -1127689200, -1111964400, -1096844400, -1080514800, -1063580400, -1049065200, -1033340400, -1017615600, -1002495600, -986166000, -969231600, -950482800, -942015600, -922662000, -906937200, -891126000, -877302000, -873676800, -864000000, -857948400, -845852400, -842832000, -831340800, -825894000, -814402800, -810777600, -799891200, -794444400, -782953200, -779328000, -768441600, -762994800, -749084400, -733359600, -717624000, -701899200, -686174400, -670449600, -654724800, -639000000, -591825600, -575496000, -559771200, -544046400, -528321600, -512596800, -496872000, -481147200, -465422400, -449697600, -433972800, -417643200, -401918400, -386193600, -370468800, -354744000, -339019200, -323294400, -307569600, -291844800, -276120000, -260395200, -244670400, -228340800, -212616000, -196891200, -181166400, -165441600, -149716800, -133992000, -118267200, 228272400, 243997200, 260326800, 276051600, 291776400, 307504800, 323226000, 338954400, 354679200, 370404000, 386128800, 401853600, 417582000, 433303200, 449028000, 465357600, 481082400, 496807200, 512532000, 528256800, 543981600, 559706400, 575431200, 591156000, 606880800, 622605600, 638330400, 654660000, 670384800, 686109600, 701834400, 717559200, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 } typeOffsets:intvector { -6160, 0, -7200, 0, -7200, 3600, -7200, 7200, -6872, 0, -3600, 0, -3600, 3600, 0, 0 } typeMap:bin { "04010201020102010201020102010201020102010201020102010201020102010201020102010201020102010203020102030201020302010203020102010201020102010201020102010201020102010201020102010201020102010201020102010506050605060506050605060506050605060506050605060506050605060506070605060506050605" } finalRule { "EU" } @@ -1733,7 +1733,7 @@ zoneinfo64:table(nofallback) { finalYear:int { 1997 } } //Z#338 /* Atlantic/Cape_Verde */ :table { - trans:intvector { -1988144756, -862610400, -764118000, 186120000 } + trans:intvector { -1830376800, -862610400, -764118000, 186120000 } typeOffsets:intvector { -5644, 0, -7200, 0, -7200, 3600, -3600, 0 } typeMap:bin { "01020103" } } //Z#339 @@ -1749,7 +1749,7 @@ zoneinfo64:table(nofallback) { } //Z#341 /* Atlantic/Jan_Mayen */ :int { 473 } //Z#342 /* Atlantic/Madeira */ :table { - trans:intvector { -1830379944, -1689552000, -1677798000, -1667433600, -1647734400, -1635811200, -1616198400, -1604361600, -1584662400, -1572739200, -1553040000, -1541203200, -1521504000, -1442448000, -1426809600, -1379289600, -1364774400, -1348444800, -1333324800, -1316390400, -1301270400, -1284336000, -1269820800, -1221436800, -1206921600, -1191196800, -1175472000, -1127692800, -1111968000, -1096848000, -1080518400, -1063584000, -1049068800, -1033344000, -1017619200, -1002499200, -986169600, -969235200, -950486400, -942019200, -922665600, -906940800, -891129600, -877305600, -873680400, -864003600, -857952000, -845856000, -842835600, -831344400, -825897600, -814406400, -810781200, -799894800, -794448000, -782956800, -779331600, -768445200, -762998400, -749088000, -733363200, -717627600, -701902800, -686178000, -670453200, -654728400, -639003600, -591829200, -575499600, -559774800, -544050000, -528325200, -512600400, -496875600, -481150800, -465426000, -449701200, -433976400, -417646800, -401922000, -386197200, -370472400, -354747600, -339022800, -323298000, -307573200, -291848400, -276123600, -260398800, -244674000, -228344400, -212619600, -196894800, -181170000, -165445200, -149720400, -133995600, -118270800, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 } + trans:intvector { -1830380400, -1689552000, -1677798000, -1667433600, -1647734400, -1635811200, -1616198400, -1604361600, -1584662400, -1572739200, -1553040000, -1541203200, -1521504000, -1442448000, -1426809600, -1379289600, -1364774400, -1348444800, -1333324800, -1316390400, -1301270400, -1284336000, -1269820800, -1221436800, -1206921600, -1191196800, -1175472000, -1127692800, -1111968000, -1096848000, -1080518400, -1063584000, -1049068800, -1033344000, -1017619200, -1002499200, -986169600, -969235200, -950486400, -942019200, -922665600, -906940800, -891129600, -877305600, -873680400, -864003600, -857952000, -845856000, -842835600, -831344400, -825897600, -814406400, -810781200, -799894800, -794448000, -782956800, -779331600, -768445200, -762998400, -749088000, -733363200, -717627600, -701902800, -686178000, -670453200, -654728400, -639003600, -591829200, -575499600, -559774800, -544050000, -528325200, -512600400, -496875600, -481150800, -465426000, -449701200, -433976400, -417646800, -401922000, -386197200, -370472400, -354747600, -339022800, -323298000, -307573200, -291848400, -276123600, -260398800, -244674000, -228344400, -212619600, -196894800, -181170000, -165445200, -149720400, -133995600, -118270800, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 } typeOffsets:intvector { -4056, 0, -3600, 0, -3600, 3600, -3600, 7200, 0, 0, 0, 3600 } typeMap:bin { "010201020102010201020102010201020102010201020102010201020102010201020102010201020102010203020102030201020302010203020102010201020102010201020102010201020102010201020102010201020102010201020102010405040504050405040504050405040504050405040504050405040504050405040504050405040504" } finalRule { "EU" } @@ -2201,7 +2201,7 @@ zoneinfo64:table(nofallback) { typeMap:bin { "010304030403040304030403040304030403020102010302010201020102010201020102010201020102010201020102010201020102010201020102010301" } } //Z#461 /* Europe/Lisbon */ :table { - trans:intvector { -1830381795, -1689555600, -1677801600, -1667437200, -1647738000, -1635814800, -1616202000, -1604365200, -1584666000, -1572742800, -1553043600, -1541206800, -1521507600, -1442451600, -1426813200, -1379293200, -1364778000, -1348448400, -1333328400, -1316394000, -1301274000, -1284339600, -1269824400, -1221440400, -1206925200, -1191200400, -1175475600, -1127696400, -1111971600, -1096851600, -1080522000, -1063587600, -1049072400, -1033347600, -1017622800, -1002502800, -986173200, -969238800, -950490000, -942022800, -922669200, -906944400, -891133200, -877309200, -873684000, -864007200, -857955600, -845859600, -842839200, -831348000, -825901200, -814410000, -810784800, -799898400, -794451600, -782960400, -779335200, -768448800, -763002000, -749091600, -733366800, -717631200, -701906400, -686181600, -670456800, -654732000, -639007200, -591832800, -575503200, -559778400, -544053600, -528328800, -512604000, -496879200, -481154400, -465429600, -449704800, -433980000, -417650400, -401925600, -386200800, -370476000, -354751200, -339026400, -323301600, -307576800, -291852000, -276127200, -260402400, -244677600, -228348000, -212623200, -196898400, -181173600, -165448800, -149724000, -133999200, -118274400, 212544000, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 } + trans:intvector { -1830384000, -1689555600, -1677801600, -1667437200, -1647738000, -1635814800, -1616202000, -1604365200, -1584666000, -1572742800, -1553043600, -1541206800, -1521507600, -1442451600, -1426813200, -1379293200, -1364778000, -1348448400, -1333328400, -1316394000, -1301274000, -1284339600, -1269824400, -1221440400, -1206925200, -1191200400, -1175475600, -1127696400, -1111971600, -1096851600, -1080522000, -1063587600, -1049072400, -1033347600, -1017622800, -1002502800, -986173200, -969238800, -950490000, -942022800, -922669200, -906944400, -891133200, -877309200, -873684000, -864007200, -857955600, -845859600, -842839200, -831348000, -825901200, -814410000, -810784800, -799898400, -794451600, -782960400, -779335200, -768448800, -763002000, -749091600, -733366800, -717631200, -701906400, -686181600, -670456800, -654732000, -639007200, -591832800, -575503200, -559778400, -544053600, -528328800, -512604000, -496879200, -481154400, -465429600, -449704800, -433980000, -417650400, -401925600, -386200800, -370476000, -354751200, -339026400, -323301600, -307576800, -291852000, -276127200, -260402400, -244677600, -228348000, -212623200, -196898400, -181173600, -165448800, -149724000, -133999200, -118274400, 212544000, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 } typeOffsets:intvector { -2205, 0, 0, 0, 0, 3600, 0, 7200, 3600, 0, 3600, 3600 } typeMap:bin { "01020102010201020102010201020102010201020102010201020102010201020102010201020102010201020302010203020102030201020302010201020102010201020102010201020102010201020102010201020102010201020102010201040102010201020102010201020102010201020102010201020102010201020102040504050405040201" } finalRule { "EU" } @@ -2605,7 +2605,7 @@ zoneinfo64:table(nofallback) { } //Z#556 /* Pacific/Enderbury */ :table { transPre32:intvector { -1, 2117555556 } - trans:intvector { 307627200, 788958000 } + trans:intvector { 307627200, 788871600 } typeOffsets:intvector { -41060, 0, -43200, 0, -39600, 0, 46800, 0 } typeMap:bin { "010203" } } //Z#557 @@ -2660,7 +2660,7 @@ zoneinfo64:table(nofallback) { /* Pacific/Johnston */ :int { 565 } //Z#566 /* Pacific/Kiritimati */ :table { transPre32:intvector { -1, 2117552256 } - trans:intvector { 307622400, 788954400 } + trans:intvector { 307622400, 788868000 } typeOffsets:intvector { -37760, 0, -38400, 0, -36000, 0, 50400, 0 } typeMap:bin { "010203" } } //Z#567 @@ -3142,7 +3142,7 @@ zoneinfo64:table(nofallback) { 8, -30, -1, 7200, 1, 3, 1, -1, 7200, 1, 3600 } //_#21 Palestine:intvector { - 2, -31, -7, 3600, 0, 9, -31, -7, 3600, 0, 3600 + 2, 22, -7, 3600, 0, 9, -31, -7, 3600, 0, 3600 } //_#22 Para:intvector { 9, 1, -1, 0, 0, 2, 22, -1, 0, 0, 3600 diff --git a/intl/uconv/nsScriptableUConv.cpp b/intl/uconv/nsScriptableUConv.cpp index 7d4e932e2..43889ffa2 100644 --- a/intl/uconv/nsScriptableUConv.cpp +++ b/intl/uconv/nsScriptableUConv.cpp @@ -11,6 +11,7 @@ #include "nsIUnicodeDecoder.h" #include "nsIUnicodeEncoder.h" #include "mozilla/dom/EncodingUtils.h" +#include "mozilla/CheckedInt.h" using mozilla::dom::EncodingUtils; @@ -39,7 +40,12 @@ nsScriptableUnicodeConverter::ConvertFromUnicodeWithLength(const nsAString& aSrc const nsAFlatString& flatSrc = PromiseFlatString(aSrc); rv = mEncoder->GetMaxLength(flatSrc.get(), inLength, aOutLen); if (NS_SUCCEEDED(rv)) { - *_retval = (char*)malloc(*aOutLen+1); + mozilla::CheckedInt<int32_t> needed(*aOutLen); + needed += 1; + if (!needed.isValid()) { + return NS_ERROR_OUT_OF_MEMORY; + } + *_retval = (char*)malloc(needed.value()); if (!*_retval) return NS_ERROR_OUT_OF_MEMORY; @@ -145,7 +151,13 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const uint8_t* aData, inLength, &outLength); if (NS_SUCCEEDED(rv)) { - char16_t* buf = (char16_t*)malloc((outLength+1) * sizeof(char16_t)); + mozilla::CheckedInt<nsACString::size_type> needed(outLength); + needed += 1; + needed *= sizeof(char16_t); + if (!needed.isValid()) { + return NS_ERROR_OUT_OF_MEMORY; + } + char16_t* buf = (char16_t*)malloc(needed.value()); if (!buf) return NS_ERROR_OUT_OF_MEMORY; diff --git a/js/src/builtin/IntlTimeZoneData.h b/js/src/builtin/IntlTimeZoneData.h index f92c583df..3d5c1b0d5 100644 --- a/js/src/builtin/IntlTimeZoneData.h +++ b/js/src/builtin/IntlTimeZoneData.h @@ -1,5 +1,5 @@ // Generated by make_intl_data.py. DO NOT EDIT. -// tzdata version = 2018c +// tzdata version = 2018d #ifndef builtin_IntlTimeZoneData_h #define builtin_IntlTimeZoneData_h diff --git a/js/src/jit/MacroAssembler.cpp b/js/src/jit/MacroAssembler.cpp index f633b9b7b..9dbbe7624 100644 --- a/js/src/jit/MacroAssembler.cpp +++ b/js/src/jit/MacroAssembler.cpp @@ -2214,6 +2214,12 @@ MacroAssembler::finish() } MacroAssemblerSpecific::finish(); + + MOZ_RELEASE_ASSERT(size() <= MaxCodeBytesPerProcess, + "AssemblerBuffer should ensure we don't exceed MaxCodeBytesPerProcess"); + + if (bytesNeeded() > MaxCodeBytesPerProcess) + setOOM(); } void diff --git a/js/src/jit/ProcessExecutableMemory.cpp b/js/src/jit/ProcessExecutableMemory.cpp index 71c2ab0dc..301541541 100644 --- a/js/src/jit/ProcessExecutableMemory.cpp +++ b/js/src/jit/ProcessExecutableMemory.cpp @@ -385,14 +385,6 @@ class PageBitSet #endif }; -// Limit on the number of bytes of executable memory to prevent JIT spraying -// attacks. -#if JS_BITS_PER_WORD == 32 -static const size_t MaxCodeBytesPerProcess = 128 * 1024 * 1024; -#else -static const size_t MaxCodeBytesPerProcess = 1 * 1024 * 1024 * 1024; -#endif - // Per-process executable memory allocator. It reserves a block of memory of // MaxCodeBytesPerProcess bytes, then allocates/deallocates pages from that. // diff --git a/js/src/jit/ProcessExecutableMemory.h b/js/src/jit/ProcessExecutableMemory.h index 078ce7cb7..a0e2fab98 100644 --- a/js/src/jit/ProcessExecutableMemory.h +++ b/js/src/jit/ProcessExecutableMemory.h @@ -17,6 +17,14 @@ namespace jit { // alignment though. static const size_t ExecutableCodePageSize = 64 * 1024; +// Limit on the number of bytes of executable memory to prevent JIT spraying +// attacks. +#if JS_BITS_PER_WORD == 32 +static const size_t MaxCodeBytesPerProcess = 128 * 1024 * 1024; +#else +static const size_t MaxCodeBytesPerProcess = 1 * 1024 * 1024 * 1024; +#endif + enum class ProtectionSetting { Protected, // Not readable, writable, or executable. Writable, diff --git a/js/src/jit/shared/IonAssemblerBuffer.h b/js/src/jit/shared/IonAssemblerBuffer.h index cc20e26d2..3a6552696 100644 --- a/js/src/jit/shared/IonAssemblerBuffer.h +++ b/js/src/jit/shared/IonAssemblerBuffer.h @@ -181,6 +181,10 @@ class AssemblerBuffer protected: virtual Slice* newSlice(LifoAlloc& a) { + if (size() > MaxCodeBytesPerProcess - sizeof(Slice)) { + fail_oom(); + return nullptr; + } Slice* tmp = static_cast<Slice*>(a.alloc(sizeof(Slice))); if (!tmp) { fail_oom(); diff --git a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h index 8cb557784..fe678fc7d 100644 --- a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h +++ b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h @@ -68,6 +68,33 @@ namespace js { namespace jit { + // AllocPolicy for AssemblerBuffer. OOMs when trying to allocate more than + // MaxCodeBytesPerProcess bytes. Use private inheritance to make sure we + // explicitly have to expose SystemAllocPolicy methods. + class AssemblerBufferAllocPolicy : private SystemAllocPolicy + { + public: + using SystemAllocPolicy::checkSimulatedOOM; + using SystemAllocPolicy::reportAllocOverflow; + using SystemAllocPolicy::free_; + + template <typename T> T* pod_realloc(T* p, size_t oldSize, size_t newSize) { + static_assert(sizeof(T) == 1, + "AssemblerBufferAllocPolicy should only be used with byte vectors"); + MOZ_ASSERT(oldSize <= MaxCodeBytesPerProcess); + if (MOZ_UNLIKELY(newSize > MaxCodeBytesPerProcess)) + return nullptr; + return SystemAllocPolicy::pod_realloc<T>(p, oldSize, newSize); + } + template <typename T> T* pod_malloc(size_t numElems) { + static_assert(sizeof(T) == 1, + "AssemblerBufferAllocPolicy should only be used with byte vectors"); + if (MOZ_UNLIKELY(numElems > MaxCodeBytesPerProcess)) + return nullptr; + return SystemAllocPolicy::pod_malloc<T>(numElems); + } + }; + class AssemblerBuffer { template<size_t size, typename T> @@ -93,6 +120,9 @@ namespace jit { void ensureSpace(size_t space) { + // This should only be called with small |space| values to ensure + // we don't overflow below. + MOZ_ASSERT(space <= 16); if (MOZ_UNLIKELY(!m_buffer.reserve(m_buffer.length() + space))) oomDetected(); } @@ -168,7 +198,7 @@ namespace jit { m_buffer.clear(); } - PageProtectingVector<unsigned char, 256, SystemAllocPolicy> m_buffer; + PageProtectingVector<unsigned char, 256, AssemblerBufferAllocPolicy> m_buffer; bool m_oom; }; diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js b/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js index 890b1c1d5..7b3a46a60 100644 --- a/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js +++ b/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js @@ -1,7 +1,7 @@ // |reftest| skip-if(!this.hasOwnProperty("Intl")) // Generated by make_intl_data.py. DO NOT EDIT. -// tzdata version = 2018c +// tzdata version = 2018d const tzMapper = [ x => x, diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js index 19fd871eb..ed63df921 100644 --- a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js +++ b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js @@ -1,7 +1,7 @@ // |reftest| skip-if(!this.hasOwnProperty("Intl")) // Generated by make_intl_data.py. DO NOT EDIT. -// tzdata version = 2018c +// tzdata version = 2018d const tzMapper = [ x => x, diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js index 34425acec..215808765 100644 --- a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js +++ b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js @@ -1,7 +1,7 @@ // |reftest| skip-if(!this.hasOwnProperty("Intl")) // Generated by make_intl_data.py. DO NOT EDIT. -// tzdata version = 2018c +// tzdata version = 2018d const tzMapper = [ x => x, diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js b/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js index 8b2dedec2..48242dfbd 100644 --- a/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js +++ b/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js @@ -1,7 +1,7 @@ // |reftest| skip-if(!this.hasOwnProperty("Intl")) // Generated by make_intl_data.py. DO NOT EDIT. -// tzdata version = 2018c +// tzdata version = 2018d const tzMapper = [ x => x, diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 59626fba4..550a7d71a 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -343,17 +343,7 @@ FontFaceSet::Load(JSContext* aCx, } } - nsIGlobalObject* globalObject = GetParentObject(); - if (!globalObject) { - aRv.Throw(NS_ERROR_FAILURE); - return nullptr; - } - - JS::Rooted<JSObject*> jsGlobal(aCx, globalObject->GetGlobalJSObject()); - GlobalObject global(aCx, jsGlobal); - - RefPtr<Promise> result = Promise::All(global, promises, aRv); - return result.forget(); + return Promise::All(aCx, promises, aRv); } bool diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index e68126068..e5a03333f 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -5111,8 +5111,8 @@ SVGTextFrame::DoGlyphPositioning() float actualTextLength = static_cast<float>(presContext->AppUnitsToGfxUnits(frameLength) * factor); - RefPtr<SVGAnimatedEnumeration> lengthAdjustEnum = element->LengthAdjust(); - uint16_t lengthAdjust = lengthAdjustEnum->AnimVal(); + uint16_t lengthAdjust = + element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST].GetAnimValue(); switch (lengthAdjust) { case SVG_LENGTHADJUST_SPACINGANDGLYPHS: // Scale the glyphs and their positions. diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index ff74d5baf..344ebf645 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1127,8 +1127,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags) if (clipPathFrame && isOK) { SVGClipPathElement *clipContent = static_cast<SVGClipPathElement*>(clipPathFrame->GetContent()); - RefPtr<SVGAnimatedEnumeration> units = clipContent->ClipPathUnits(); - if (units->AnimVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + if (clipContent->IsUnitsObjectBoundingBox()) { matrix.Translate(gfxPoint(x, y)); matrix.Scale(width, height); } else if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) { diff --git a/netwerk/base/nsBufferedStreams.h b/netwerk/base/nsBufferedStreams.h index 93a770beb..fee55695a 100644 --- a/netwerk/base/nsBufferedStreams.h +++ b/netwerk/base/nsBufferedStreams.h @@ -88,10 +88,10 @@ protected: //////////////////////////////////////////////////////////////////////////////// -class nsBufferedOutputStream final : public nsBufferedStream, - public nsISafeOutputStream, - public nsIBufferedOutputStream, - public nsIStreamBufferAccess +class nsBufferedOutputStream : public nsBufferedStream, + public nsISafeOutputStream, + public nsIBufferedOutputStream, + public nsIStreamBufferAccess { public: NS_DECL_ISUPPORTS_INHERITED diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp index 21c4cf7fd..0cdd2a7b5 100644 --- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -3442,10 +3442,29 @@ ToIPCSegment(const nsStandardURL::URLSegment& aSegment) } inline -nsStandardURL::URLSegment -FromIPCSegment(const ipc::StandardURLSegment& aSegment) +MOZ_MUST_USE bool +FromIPCSegment(const nsACString& aSpec, const ipc::StandardURLSegment& aSegment, nsStandardURL::URLSegment& aTarget) { - return nsStandardURL::URLSegment(aSegment.position(), aSegment.length()); + // This seems to be just an empty segment. + if (aSegment.length() == -1) { + aTarget = nsStandardURL::URLSegment(); + return true; + } + + // A value of -1 means an empty segment, but < -1 is undefined. + if (NS_WARN_IF(aSegment.length() < -1)) { + return false; + } + + // Make sure the segment does not extend beyond the spec. + if (NS_WARN_IF(aSegment.position() + aSegment.length() > aSpec.Length())) { + return false; + } + + aTarget.mPos = aSegment.position(); + aTarget.mLen = aSegment.length(); + + return true; } void @@ -3520,23 +3539,38 @@ nsStandardURL::Deserialize(const URIParams& aParams) mPort = params.port(); mDefaultPort = params.defaultPort(); mSpec = params.spec(); - mScheme = FromIPCSegment(params.scheme()); - mAuthority = FromIPCSegment(params.authority()); - mUsername = FromIPCSegment(params.username()); - mPassword = FromIPCSegment(params.password()); - mHost = FromIPCSegment(params.host()); - mPath = FromIPCSegment(params.path()); - mFilepath = FromIPCSegment(params.filePath()); - mDirectory = FromIPCSegment(params.directory()); - mBasename = FromIPCSegment(params.baseName()); - mExtension = FromIPCSegment(params.extension()); - mQuery = FromIPCSegment(params.query()); - mRef = FromIPCSegment(params.ref()); + + NS_ENSURE_TRUE(mSpec.Length() <= (uint32_t) net_GetURLMaxLength(), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.scheme(), mScheme), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.authority(), mAuthority), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.username(), mUsername), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.password(), mPassword), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.host(), mHost), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.path(), mPath), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.filePath(), mFilepath), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.directory(), mDirectory), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.baseName(), mBasename), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.extension(), mExtension), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.query(), mQuery), false); + NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.ref(), mRef), false); + mOriginCharset = params.originCharset(); mMutable = params.isMutable(); mSupportsFileURL = params.supportsFileURL(); mHostEncoding = params.hostEncoding(); + // Some sanity checks + NS_ENSURE_TRUE(mScheme.mPos == 0, false); + NS_ENSURE_TRUE(mScheme.mLen > 0, false); + // Make sure scheme is followed by :// (3 characters) + NS_ENSURE_TRUE(mScheme.mLen < INT32_MAX - 3, false); // avoid overflow + NS_ENSURE_TRUE(mSpec.Length() >= (uint32_t) mScheme.mLen + 3, false); + NS_ENSURE_TRUE(nsDependentCSubstring(mSpec, mScheme.mLen, 3).EqualsLiteral("://"), false); + NS_ENSURE_TRUE(mPath.mLen != -1 && mSpec.CharAt(mPath.mPos) == '/', false); + NS_ENSURE_TRUE(mPath.mPos == mFilepath.mPos, false); + NS_ENSURE_TRUE(mQuery.mLen == -1 || mSpec.CharAt(mQuery.mPos - 1) == '?', false); + NS_ENSURE_TRUE(mRef.mLen == -1 || mSpec.CharAt(mRef.mPos - 1) == '#', false); + // mSpecEncoding and mHostA are just caches that can be recovered as needed. return true; } diff --git a/toolkit/components/url-classifier/HashStore.cpp b/toolkit/components/url-classifier/HashStore.cpp index c298612aa..77bf3cbd4 100644 --- a/toolkit/components/url-classifier/HashStore.cpp +++ b/toolkit/components/url-classifier/HashStore.cpp @@ -964,8 +964,7 @@ HashStore::WriteFile() NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIOutputStream> out; - rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile, - PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE); + rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile); NS_ENSURE_SUCCESS(rv, rv); uint32_t written; diff --git a/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp b/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp index 68f9f1f6f..0e89fd20c 100644 --- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp +++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp @@ -13,14 +13,11 @@ // nsCheckSummedOutputStream NS_IMPL_ISUPPORTS_INHERITED(nsCheckSummedOutputStream, - nsSafeFileOutputStream, - nsISafeOutputStream, - nsIOutputStream, - nsIFileOutputStream) + nsBufferedOutputStream, + nsISafeOutputStream) NS_IMETHODIMP -nsCheckSummedOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm, - int32_t behaviorFlags) +nsCheckSummedOutputStream::Init(nsIOutputStream* stream, uint32_t bufferSize) { nsresult rv; mHash = do_CreateInstance(NS_CRYPTO_HASH_CONTRACTID, &rv); @@ -29,7 +26,7 @@ nsCheckSummedOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm, rv = mHash->Init(nsICryptoHash::MD5); NS_ENSURE_SUCCESS(rv, rv); - return nsSafeFileOutputStream::Init(file, ioFlags, perm, behaviorFlags); + return nsBufferedOutputStream::Init(stream, bufferSize); } NS_IMETHODIMP @@ -39,12 +36,12 @@ nsCheckSummedOutputStream::Finish() NS_ENSURE_SUCCESS(rv, rv); uint32_t written; - rv = nsSafeFileOutputStream::Write(reinterpret_cast<const char*>(mCheckSum.BeginReading()), + rv = nsBufferedOutputStream::Write(reinterpret_cast<const char*>(mCheckSum.BeginReading()), mCheckSum.Length(), &written); NS_ASSERTION(written == mCheckSum.Length(), "Error writing stream checksum"); NS_ENSURE_SUCCESS(rv, rv); - return nsSafeFileOutputStream::Finish(); + return nsBufferedOutputStream::Finish(); } NS_IMETHODIMP @@ -53,7 +50,7 @@ nsCheckSummedOutputStream::Write(const char *buf, uint32_t count, uint32_t *resu nsresult rv = mHash->Update(reinterpret_cast<const uint8_t*>(buf), count); NS_ENSURE_SUCCESS(rv, rv); - return nsSafeFileOutputStream::Write(buf, count, result); + return nsBufferedOutputStream::Write(buf, count, result); } //////////////////////////////////////////////////////////////////////////////// diff --git a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h index c2fe26b5f..b72c7da86 100644 --- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h +++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h @@ -12,25 +12,27 @@ #include "nsICryptoHash.h" #include "nsNetCID.h" #include "nsString.h" -#include "../../../netwerk/base/nsFileStreams.h" #include "nsToolkitCompsCID.h" +#include "../../../netwerk/base/nsBufferedStreams.h" +#include "prio.h" -class nsCheckSummedOutputStream : public nsSafeFileOutputStream +class nsCheckSummedOutputStream : public nsBufferedOutputStream { public: NS_DECL_ISUPPORTS_INHERITED // Size of MD5 hash in bytes static const uint32_t CHECKSUM_SIZE = 16; + static const uint32_t MAX_BUFFER_SIZE = 64 * 1024; nsCheckSummedOutputStream() {} NS_IMETHOD Finish() override; NS_IMETHOD Write(const char *buf, uint32_t count, uint32_t *result) override; - NS_IMETHOD Init(nsIFile* file, int32_t ioFlags, int32_t perm, int32_t behaviorFlags) override; + NS_IMETHOD Init(nsIOutputStream* stream, uint32_t bufferSize) override; protected: - virtual ~nsCheckSummedOutputStream() { nsSafeFileOutputStream::Close(); } + virtual ~nsCheckSummedOutputStream() { nsBufferedOutputStream::Close(); } nsCOMPtr<nsICryptoHash> mHash; nsCString mCheckSum; @@ -39,13 +41,15 @@ protected: // returns a file output stream which can be QI'ed to nsIFileOutputStream. inline nsresult NS_NewCheckSummedOutputStream(nsIOutputStream **result, - nsIFile *file, - int32_t ioFlags = -1, - int32_t perm = -1, - int32_t behaviorFlags = 0) + nsIFile *file) { - nsCOMPtr<nsIFileOutputStream> out = new nsCheckSummedOutputStream(); - nsresult rv = out->Init(file, ioFlags, perm, behaviorFlags); + nsCOMPtr<nsIOutputStream> localOutFile; + nsresult rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(localOutFile), file, + PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr<nsIBufferedOutputStream> out = new nsCheckSummedOutputStream(); + rv = out->Init(localOutFile, nsCheckSummedOutputStream::CHECKSUM_SIZE); if (NS_SUCCEEDED(rv)) { out.forget(result); } diff --git a/xpcom/glue/PLDHashTable.cpp b/xpcom/glue/PLDHashTable.cpp index 6152e9000..5e932ccb2 100644 --- a/xpcom/glue/PLDHashTable.cpp +++ b/xpcom/glue/PLDHashTable.cpp @@ -216,17 +216,17 @@ PLDHashTable::operator=(PLDHashTable&& aOther) return *this; } - // Destruct |this|. - this->~PLDHashTable(); - - // |mOps| and |mEntrySize| are const so we can't assign them. Instead, we - // require that they are equal. The justification for this is that they're + // |mOps| and |mEntrySize| are required to stay the same, they're // conceptually part of the type -- indeed, if PLDHashTable was a templated // type like nsTHashtable, they *would* be part of the type -- so it only // makes sense to assign in cases where they match. MOZ_RELEASE_ASSERT(mOps == aOther.mOps); MOZ_RELEASE_ASSERT(mEntrySize == aOther.mEntrySize); + // Reconstruct |this|. + this->~PLDHashTable(); + new (KnownNotNull, this) PLDHashTable(aOther.mOps, aOther.mEntrySize, 0); + // Move non-const pieces over. mHashShift = Move(aOther.mHashShift); mEntryCount = Move(aOther.mEntryCount); |