[Scummvm-git-logs] scummvm master -> 84cfd2ca4f5ab158960bf1b6a5f1418072dfea51

lephilousophe noreply at scummvm.org
Sat Dec 28 11:48:44 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
84cfd2ca4f GUI: Properly init _alphaType


Commit: 84cfd2ca4f5ab158960bf1b6a5f1418072dfea51
    https://github.com/scummvm/scummvm/commit/84cfd2ca4f5ab158960bf1b6a5f1418072dfea51
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-28T12:47:56+01:00

Commit Message:
GUI: Properly init _alphaType

This is not needed per se but without it UBSan warns in drawWidget
because of the uninitialized read.

Really fixes GH-6323.

Changed paths:
    gui/widget.cpp


diff --git a/gui/widget.cpp b/gui/widget.cpp
index 0fdb8f3d52a..36612d2a64e 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -619,7 +619,7 @@ const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, in
 PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, bool scale, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
 	: ButtonWidget(boss, x, y, w, h, scale, Common::U32String(), tooltip, cmd, hotkey),
 	  _showButton(true) {
-
+	Common::fill(_alphaType, _alphaType + ARRAYSIZE(_alphaType), Graphics::ALPHA_OPAQUE);
 	setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG);
 	_type = kButtonWidget;
 }
@@ -631,6 +631,7 @@ PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, co
 PicButtonWidget::PicButtonWidget(GuiObject *boss, const Common::String &name, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)
 	: ButtonWidget(boss, name, Common::U32String(), tooltip, cmd, hotkey),
 	  _showButton(true) {
+	Common::fill(_alphaType, _alphaType + ARRAYSIZE(_alphaType), Graphics::ALPHA_OPAQUE);
 	setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG);
 	_type = kButtonWidget;
 }
@@ -722,7 +723,7 @@ void PicButtonWidget::drawWidget() {
 	}
 	if (!gfx->getPixels()) {
 		gfx = &_gfx[kPicButtonStateEnabled];
-		alphaType= _alphaType[kPicButtonStateEnabled];
+		alphaType = _alphaType[kPicButtonStateEnabled];
 	}
 
 	if (gfx->getPixels()) {




More information about the Scummvm-git-logs mailing list