summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-06-04 18:21:04 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-06-04 18:21:04 +0200
commitdee00a8a79394559e0e868cc72464c2de24583ac (patch)
tree18dc2e3db8127ceabcf9b03416b135bced2976ad /widget
parent851cfd198bc01020cd411d4f1cd6586222700269 (diff)
parent363bfeb2c06e5f57136ebdab8da1ebeba0591520 (diff)
downloadUXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar.gz
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar.lz
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.tar.xz
UXP-dee00a8a79394559e0e868cc72464c2de24583ac.zip
Merge branch 'master' into Basilisk-release
Diffstat (limited to 'widget')
-rw-r--r--widget/cocoa/nsNativeThemeCocoa.mm2
-rw-r--r--widget/windows/nsClipboard.cpp16
2 files changed, 11 insertions, 7 deletions
diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm
index 3c8695442..fc4f7f2e9 100644
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -2779,7 +2779,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
(isOverlay ? @"kCUIWidgetOverlayScrollBar" : @"scrollbar"), @"widget",
(isSmall ? @"small" : @"regular"), @"size",
(isHorizontal ? @"kCUIOrientHorizontal" : @"kCUIOrientVertical"), @"kCUIOrientationKey",
- (isOnTopOfDarkBackground ? @"kCUIVariantWhite" : @""), @"kCUIVariantKey",
+ (isOverlay && isOnTopOfDarkBackground ? @"kCUIVariantWhite" : @""), @"kCUIVariantKey",
[NSNumber numberWithBool:YES], @"indiconly",
[NSNumber numberWithBool:YES], @"kCUIThumbProportionKey",
[NSNumber numberWithBool:YES], @"is.flipped",
diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp
index c93f351c8..0ca9568d0 100644
--- a/widget/windows/nsClipboard.cpp
+++ b/widget/windows/nsClipboard.cpp
@@ -291,16 +291,20 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
nsresult result = NS_ERROR_FAILURE;
if (aHGBL != nullptr) {
LPSTR lpStr = (LPSTR) GlobalLock(aHGBL);
- DWORD allocSize = GlobalSize(aHGBL);
- char* data = static_cast<char*>(malloc(allocSize + 3));
+ CheckedInt<uint32_t> allocSize = CheckedInt<uint32_t>(GlobalSize(aHGBL)) + 3;
+ if (!allocSize.isValid()) {
+ return NS_ERROR_INVALID_ARG;
+ }
+ char* data = static_cast<char*>(malloc(allocSize.value()));
if ( data ) {
- memcpy ( data, lpStr, allocSize );
- data[allocSize] = data[allocSize + 1] = data[allocSize + 2] =
- '\0'; // null terminate for safety
+ uint32_t size = allocSize.value() - 3;
+ memcpy(data, lpStr, size);
+ // null terminate for safety
+ data[size] = data[size + 1] = data[size + 2] = '\0';
GlobalUnlock(aHGBL);
*aData = data;
- *aLen = allocSize;
+ *aLen = size;
result = NS_OK;
}