[Scummvm-git-logs] scummvm master -> f0d51e1a13f679a333f92266179ddfdf45c13ffb
dreammaster
noreply at scummvm.org
Sat Aug 1 08:34:40 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
f0d51e1a13 MADS: Fix Coverity warnings
Commit: f0d51e1a13f679a333f92266179ddfdf45c13ffb
https://github.com/scummvm/scummvm/commit/f0d51e1a13f679a333f92266179ddfdf45c13ffb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-01T18:34:22+10:00
Commit Message:
MADS: Fix Coverity warnings
Changed paths:
engines/mads/core/popup.cpp
engines/mads/core/sound_manager.h
engines/mads/core/sprite.cpp
engines/mads/core/window.cpp
diff --git a/engines/mads/core/popup.cpp b/engines/mads/core/popup.cpp
index 327e6d8f6d4..c1d8f937738 100644
--- a/engines/mads/core/popup.cpp
+++ b/engines/mads/core/popup.cpp
@@ -1190,6 +1190,7 @@ int popup_alert(int width, const char *message_line, ...) {
my_message = va_arg(marker, char *);
first_time = false;
}
+ va_end(marker);
error_flag = popup_and_wait(true);
@@ -1390,6 +1391,12 @@ Popup *popup_dialog_create(void *memory, long heap_size, int max_items) {
if ((heap_size == 0) && (memory == NULL)) heap_size = 2048;
if (!max_items) max_items = 10;
+ // heap_size must cover at least the Popup header itself, or the
+ // heap_declare() call below would underflow (heap_size - sizeof(Popup))
+ // into a negative heap size, leading heap_get() to always fail and its
+ // unchecked NULL result to be dereferenced further down.
+ if (heap_size < (long)sizeof(Popup)) goto done;
+
if (memory == NULL) {
status |= POPUP_STATUS_DYNAMIC;
block = (byte *)mem_get_name(heap_size, "$popheap");
diff --git a/engines/mads/core/sound_manager.h b/engines/mads/core/sound_manager.h
index e7564245f5d..b592f489a1c 100644
--- a/engines/mads/core/sound_manager.h
+++ b/engines/mads/core/sound_manager.h
@@ -106,7 +106,7 @@ public:
SoundManager(Audio::Mixer *mixer, bool &soundFlag);
virtual ~SoundManager();
- bool _preferRoland;
+ //bool _preferRoland = false;
/**
* Validate the sound driver files needed for data
diff --git a/engines/mads/core/sprite.cpp b/engines/mads/core/sprite.cpp
index 50da3b87215..f6dc7c8a6e0 100644
--- a/engines/mads/core/sprite.cpp
+++ b/engines/mads/core/sprite.cpp
@@ -294,7 +294,7 @@ void sprite_draw_3d_scaled_mono(SeriesPtr series, int id,
void WalkerInfo::load(Load &load_handle) {
// Load in the needed data
byte buffer[SIZE];
- loader_read(buffer, SIZE, 1, &load_handle);
+ (void)loader_read(buffer, SIZE, 1, &load_handle);
Common::MemoryReadStream src(buffer, SIZE);
load(&src);
@@ -617,14 +617,14 @@ SeriesPtr sprite_series_load(const char *filename, int load_flags) {
}
if (!(load_flags & SPRITE_LOAD_HEADER_ONLY)) {
- if (color_list != NULL) mem_free(color_list);
+ mem_free(color_list);
color_list = NULL;
-
- if (sprite != NULL) mem_free(sprite);
+ mem_free(sprite);
sprite = NULL;
target->arena = (byte *)mem_get_name(largest_block, "$arena$");
- if (target->arena == NULL) goto done;
+ if (target->arena == NULL)
+ goto done;
memcpy(&target->misc_largest_block, &largest_block, sizeof(long));
diff --git a/engines/mads/core/window.cpp b/engines/mads/core/window.cpp
index 2d7d5345512..39be03cff40 100644
--- a/engines/mads/core/window.cpp
+++ b/engines/mads/core/window.cpp
@@ -98,14 +98,10 @@ void window_shadow(WindowPtr window) {
short x_count, y_count, max_x, max_y;
short my_color;
- if (screen == nullptr /*mono_text_video*/) {
- my_color = colorbyte(black, black);
- } else {
- my_color = window_shadow_color;
- }
+ assert(screen);
+ my_color = window_shadow_color;
if ((window->lr_x <= (screen_max_x - 2)) || (window->lr_y <= (screen_max_y - 1))) {
-
if (window->lr_x <= (screen_max_x - 2)) {
max_y = MIN(window->lr_y + 1, screen_max_y);
for (x_count = window->lr_x + 1; x_count <= window->lr_x + 2; x_count++) {
@@ -705,6 +701,7 @@ void window_trap_output(WindowPtr window,
next_trap_string = va_arg(marker, char *);
}
+ va_end(marker);
window_server_installed = true;
}
More information about the Scummvm-git-logs
mailing list