зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1272203 (part 3) - Use NotNull in nsContentUtils::GetSurfaceData(). r=froydnj.
This might not look compelling in isolation, but this use of NotNull would have prevented the null dereference crash in bug 1268721.
This commit is contained in:
Родитель
19c16a645a
Коммит
62f0bd3e33
|
@ -7424,7 +7424,8 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
||||||
size_t length;
|
size_t length;
|
||||||
int32_t stride;
|
int32_t stride;
|
||||||
mozilla::UniquePtr<char[]> surfaceData =
|
mozilla::UniquePtr<char[]> surfaceData =
|
||||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length,
|
||||||
|
&stride);
|
||||||
|
|
||||||
IPCDataTransferItem* item = aIPCDataTransfer->items().AppendElement();
|
IPCDataTransferItem* item = aIPCDataTransfer->items().AppendElement();
|
||||||
item->flavor() = flavorStr;
|
item->flavor() = flavorStr;
|
||||||
|
@ -7528,7 +7529,8 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::UniquePtr<char[]>
|
mozilla::UniquePtr<char[]>
|
||||||
nsContentUtils::GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
nsContentUtils::GetSurfaceData(
|
||||||
|
NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||||
size_t* aLength, int32_t* aStride)
|
size_t* aLength, int32_t* aStride)
|
||||||
{
|
{
|
||||||
mozilla::gfx::DataSourceSurface::MappedSurface map;
|
mozilla::gfx::DataSourceSurface::MappedSurface map;
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "mozilla/FloatingPoint.h"
|
#include "mozilla/FloatingPoint.h"
|
||||||
#include "mozilla/net/ReferrerPolicy.h"
|
#include "mozilla/net/ReferrerPolicy.h"
|
||||||
#include "mozilla/Logging.h"
|
#include "mozilla/Logging.h"
|
||||||
|
#include "mozilla/NotNull.h"
|
||||||
#include "nsIContentPolicy.h"
|
#include "nsIContentPolicy.h"
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
|
@ -2432,7 +2433,8 @@ public:
|
||||||
* Get the pixel data from the given source surface and return it as a buffer.
|
* Get the pixel data from the given source surface and return it as a buffer.
|
||||||
* The length and stride will be assigned from the surface.
|
* The length and stride will be assigned from the surface.
|
||||||
*/
|
*/
|
||||||
static mozilla::UniquePtr<char[]> GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
static mozilla::UniquePtr<char[]> GetSurfaceData(
|
||||||
|
mozilla::NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||||
size_t* aLength, int32_t* aStride);
|
size_t* aLength, int32_t* aStride);
|
||||||
|
|
||||||
// Helpers shared by the implementations of nsContentUtils methods and
|
// Helpers shared by the implementations of nsContentUtils methods and
|
||||||
|
|
|
@ -990,7 +990,7 @@ PuppetWidget::SetCursor(imgIContainer* aCursor,
|
||||||
size_t length;
|
size_t length;
|
||||||
int32_t stride;
|
int32_t stride;
|
||||||
mozilla::UniquePtr<char[]> surfaceData =
|
mozilla::UniquePtr<char[]> surfaceData =
|
||||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length, &stride);
|
||||||
|
|
||||||
nsDependentCString cursorData(surfaceData.get(), length);
|
nsDependentCString cursorData(surfaceData.get(), length);
|
||||||
mozilla::gfx::IntSize size = dataSurface->GetSize();
|
mozilla::gfx::IntSize size = dataSurface->GetSize();
|
||||||
|
|
|
@ -55,7 +55,8 @@ nsDragServiceProxy::InvokeDragSessionImpl(nsISupportsArray* aArrayTransferables,
|
||||||
size_t length;
|
size_t length;
|
||||||
int32_t stride;
|
int32_t stride;
|
||||||
mozilla::UniquePtr<char[]> surfaceData =
|
mozilla::UniquePtr<char[]> surfaceData =
|
||||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length,
|
||||||
|
&stride);
|
||||||
nsDependentCString dragImage(surfaceData.get(), length);
|
nsDependentCString dragImage(surfaceData.get(), length);
|
||||||
|
|
||||||
mozilla::Unused <<
|
mozilla::Unused <<
|
||||||
|
|
Загрузка…
Ссылка в новой задаче