From 4aefa55c19319a2ff3cc67aede71739adf969cf5 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Mon, 5 Aug 2019 06:26:56 +0000 Subject: [PATCH] Bug 1565396 - Annotate use of memcpy instead of memcpySafeWhenRacy in WebGLBuffer. r=hsivonen Differential Revision: https://phabricator.services.mozilla.com/D37802 --HG-- extra : moz-landing-system : lando --- dom/canvas/WebGLBuffer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dom/canvas/WebGLBuffer.cpp b/dom/canvas/WebGLBuffer.cpp index cb2afa8155e9..628789bc0bf3 100644 --- a/dom/canvas/WebGLBuffer.cpp +++ b/dom/canvas/WebGLBuffer.cpp @@ -105,6 +105,12 @@ void WebGLBuffer::BufferData(GLenum target, uint64_t size, const void* data, mContext->ErrorOutOfMemory("Failed to alloc index cache."); return; } + // memcpy out of SharedArrayBuffers can be racey, and should generally use + // memcpySafeWhenRacy. But it's safe here: + // * We only memcpy in one place. + // * We only read out of the single copy, and only after copying. + // * If we get data value corruption from racing read-during-write, that's + // fine. memcpy(newIndexCache.get(), data, size); uploadData = newIndexCache.get(); }