[Scummvm-git-logs] scummvm master -> d76f6dc8ad9e6d5910d5a68097456ad9c4033d8e
kelmer44
noreply at scummvm.org
Fri Jul 10 09:06:14 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:
d76f6dc8ad PELROCK: Fixes high severity coverity issues
Commit: d76f6dc8ad9e6d5910d5a68097456ad9c4033d8e
https://github.com/scummvm/scummvm/commit/d76f6dc8ad9e6d5910d5a68097456ad9c4033d8e
Author: kelmer (kelmer at gmail.com)
Date: 2026-07-10T11:06:04+02:00
Commit Message:
PELROCK: Fixes high severity coverity issues
Changed paths:
engines/pelrock/computer.cpp
engines/pelrock/pelrock.cpp
engines/pelrock/sound.h
engines/pelrock/video.cpp
diff --git a/engines/pelrock/computer.cpp b/engines/pelrock/computer.cpp
index c07b00f6c19..e50930fd37e 100644
--- a/engines/pelrock/computer.cpp
+++ b/engines/pelrock/computer.cpp
@@ -27,11 +27,11 @@
#include "pelrock/computer.h"
#include "pelrock/events.h"
+#include "pelrock/fonts/small_font.h"
#include "pelrock/graphics.h"
#include "pelrock/pelrock.h"
#include "pelrock/resources.h"
#include "pelrock/room.h"
-#include "pelrock/fonts/small_font.h"
namespace Pelrock {
@@ -189,75 +189,82 @@ void Computer::drawScreen() {
const char *section = _searchType == 0 ? _titleMsg.c_str() : _authorMsg.c_str();
Common::String title = _computerText[2][0];
int replacementIndex = title.findFirstOf("XXXXXXX");
+ if (replacementIndex != -1) {
+
+ title.replace(replacementIndex, 7, section);
+ int replacementIndex2 = title.findFirstOf("X");
+ title.replace(replacementIndex2, 1, Common::String(1, _searchLetter));
+ g_engine->_graphics->drawColoredText(g_engine->_screen, title, 210, 97, 200, defaultColor, g_engine->_smallFont);
+
+ int textX = 161;
+ int textY = 131;
+ int increment = 28;
+
+ // Display current book
+ int bookIdx = _searchResults[_currentResult];
+ const LibraryBook &book = _libraryBooks[bookIdx];
- title.replace(replacementIndex, 7, section);
- int replacementIndex2 = title.findFirstOf("X");
- title.replace(replacementIndex2, 1, Common::String(1, _searchLetter));
- g_engine->_graphics->drawColoredText(g_engine->_screen, title, 210, 97, 200, defaultColor, g_engine->_smallFont);
-
- int textX = 161;
- int textY = 131;
- int increment = 28;
-
- // Display current book
- int bookIdx = _searchResults[_currentResult];
- const LibraryBook &book = _libraryBooks[bookIdx];
-
- // Title (may be long, truncate if needed)
- Common::String titleLine = _computerText[3][0];
- int titlePlaceholderIndex = titleLine.findFirstOf("XXXX");
-
- uint titleIndex = 0;
- while (titleIndex < book.title.size()) {
- Common::String thisLine;
- if (titleIndex == 0) {
- thisLine = titleLine;
- thisLine.replace(titlePlaceholderIndex, titleLine.size() - titlePlaceholderIndex, book.title[titleIndex]);
- } else {
- thisLine = book.title[titleIndex];
+ // Title (may be long, truncate if needed)
+ Common::String titleLine = _computerText[3][0];
+ int titlePlaceholderIndex = titleLine.findFirstOf("XXXX");
+
+ uint titleIndex = 0;
+ while (titleIndex < book.title.size()) {
+ Common::String thisLine;
+ if (titleIndex == 0) {
+ thisLine = titleLine;
+ thisLine.replace(titlePlaceholderIndex, titleLine.size() - titlePlaceholderIndex, book.title[titleIndex]);
+ } else {
+ thisLine = book.title[titleIndex];
+ }
+ g_engine->_graphics->drawColoredText(g_engine->_screen, thisLine, textX, textY + _lineHeight * titleIndex, 340, defaultColor, g_engine->_smallFont);
+ titleIndex++;
}
- g_engine->_graphics->drawColoredText(g_engine->_screen, thisLine, textX, textY + _lineHeight * titleIndex, 340, defaultColor, g_engine->_smallFont);
- titleIndex++;
- }
- // Author
- Common::String authorLine = _computerText[4][0];
- int authorPlaceholderIndex = authorLine.findFirstOf("XXXX");
- uint authorIndex = 0;
-
- while (authorIndex < book.author.size()) {
- Common::String thisLine;
- if (authorIndex == 0) {
- thisLine = authorLine;
- thisLine.replace(authorPlaceholderIndex, authorLine.size() - authorPlaceholderIndex, book.author[authorIndex]);
- } else {
- thisLine = book.author[authorIndex];
+ // Author
+ Common::String authorLine = _computerText[4][0];
+ int authorPlaceholderIndex = authorLine.findFirstOf("XXXX");
+ if (authorPlaceholderIndex != -1) {
+ authorLine.replace(authorPlaceholderIndex, authorLine.size() - authorPlaceholderIndex, book.author[0]);
+
+ uint authorIndex = 0;
+
+ while (authorIndex < book.author.size()) {
+ Common::String thisLine;
+ if (authorIndex == 0) {
+ thisLine = authorLine;
+ thisLine.replace(authorPlaceholderIndex, authorLine.size() - authorPlaceholderIndex, book.author[authorIndex]);
+ } else {
+ thisLine = book.author[authorIndex];
+ }
+ g_engine->_graphics->drawColoredText(g_engine->_screen, thisLine, textX, textY + increment + _lineHeight * authorIndex, 340, defaultColor, g_engine->_smallFont);
+ authorIndex++;
+ }
}
- g_engine->_graphics->drawColoredText(g_engine->_screen, thisLine, textX, textY + increment + _lineHeight * authorIndex, 340, defaultColor, g_engine->_smallFont);
- authorIndex++;
- }
- // Genre
- Common::String genreLine = _computerText[5][0];
- int genrePlaceholderIndex = genreLine.findFirstOf("XXXX");
- genreLine.replace(genrePlaceholderIndex, genreLine.size() - genrePlaceholderIndex, book.genre);
- g_engine->_graphics->drawColoredText(g_engine->_screen, genreLine, textX, textY + increment * 2, 340, defaultColor, g_engine->_smallFont);
-
- // "Situacion" (location/availability)
- Common::String situacionLine = _computerText[6][0];
- int situacionPlaceholderIndex = situacionLine.findFirstOf("XXXX");
- situacionLine.replace(situacionPlaceholderIndex, situacionLine.size() - situacionPlaceholderIndex, book.available ? _computerText[8][0] : _computerText[9][0]);
- g_engine->_graphics->drawColoredText(g_engine->_screen, situacionLine, textX, textY + increment * 3, 340, defaultColor, g_engine->_smallFont);
-
- // Show navigation options
- Common::String navOptions;
- Common::String actions = _computerText[7][0];
- if (!book.available) {
- actions.setChar((char)180, 1);
- actions.setChar((char)180, 4);
+ // Genre
+ Common::String genreLine = _computerText[5][0];
+ int genrePlaceholderIndex = genreLine.findFirstOf("XXXX");
+ if (genrePlaceholderIndex != -1) {
+ genreLine.replace(genrePlaceholderIndex, genreLine.size() - genrePlaceholderIndex, book.genre);
+ g_engine->_graphics->drawColoredText(g_engine->_screen, genreLine, textX, textY + increment * 2, 340, defaultColor, g_engine->_smallFont);
+ }
+ // "Situacion" (location/availability)
+ Common::String situacionLine = _computerText[6][0];
+ int situacionPlaceholderIndex = situacionLine.findFirstOf("XXXX");
+ if (situacionPlaceholderIndex != -1) {
+ situacionLine.replace(situacionPlaceholderIndex, situacionLine.size() - situacionPlaceholderIndex, book.available ? _computerText[8][0] : _computerText[9][0]);
+ g_engine->_graphics->drawColoredText(g_engine->_screen, situacionLine, textX, textY + increment * 3, 340, defaultColor, g_engine->_smallFont);
+ }
+ // Show navigation options
+ Common::String navOptions;
+ Common::String actions = _computerText[7][0];
+ if (!book.available) {
+ actions.setChar((char)180, 1);
+ actions.setChar((char)180, 4);
+ }
+ g_engine->_graphics->drawColoredText(g_engine->_screen, actions, 174, 258, 325, defaultColor, g_engine->_smallFont);
}
- g_engine->_graphics->drawColoredText(g_engine->_screen, actions, 174, 258, 325, defaultColor, g_engine->_smallFont);
-
} break;
case STATE_EXIT:
@@ -338,7 +345,6 @@ void Computer::memorizeBook(int bookIndex) {
g_engine->_state->libraryShelf = book.shelf; // 0-based shelf index
g_engine->_state->selectedBookIndex = book.inventoryIndex;
g_engine->_state->bookLetter = book.title[0][0];
-
}
void Computer::performSearch() {
diff --git a/engines/pelrock/pelrock.cpp b/engines/pelrock/pelrock.cpp
index 6ccdcb94c44..86e3de705c9 100644
--- a/engines/pelrock/pelrock.cpp
+++ b/engines/pelrock/pelrock.cpp
@@ -2091,6 +2091,7 @@ void PelrockEngine::pyramidCollapse() {
pyramidHotspot->index = 7;
_room->disableHotspot(21, pyramidHotspot, PERSIST_BOTH);
+ free(pyramidHotspot);
_dialog->say(_res->_ingameTexts[kTextTaLuegoLucas]);
// Walk Alfred to right edge exit -> room 21
diff --git a/engines/pelrock/sound.h b/engines/pelrock/sound.h
index 98e36a44f9d..2c235552561 100644
--- a/engines/pelrock/sound.h
+++ b/engines/pelrock/sound.h
@@ -30,7 +30,6 @@ struct SonidoFile {
Common::String filename;
uint32 offset;
uint32 size;
- byte *data;
};
extern const char *SOUND_FILENAMES[];
diff --git a/engines/pelrock/video.cpp b/engines/pelrock/video.cpp
index 00917ec87a5..37d7b35f9a9 100644
--- a/engines/pelrock/video.cpp
+++ b/engines/pelrock/video.cpp
@@ -315,6 +315,7 @@ void VideoManager::initMetadata() {
MusicEffect VideoManager::readMusicEffect(Common::File &metadataFile) {
MusicEffect music;
Common::String buffer;
+ music.startFrame = 0;
// Skip spaces after "/c"
while (!metadataFile.eos() && metadataFile.readByte() == ' ')
@@ -343,6 +344,7 @@ MusicEffect VideoManager::readMusicEffect(Common::File &metadataFile) {
AudioEffect VideoManager::readAudioEffect(Common::File &metadataFile) {
AudioEffect voice;
Common::String buffer;
+ voice.startFrame = 0;
// Skip spaces after "/x"
while (!metadataFile.eos() && metadataFile.readByte() == ' ')
More information about the Scummvm-git-logs
mailing list