[Scummvm-cvs-logs] scummvm master -> ce0cc0ee857740cb0bd1ebd3b4bfa6eefc31aee6
sev-
sev at scummvm.org
Sun Apr 17 14:22:54 CEST 2011
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:
ce0cc0ee85 COMMON: Partial fix for #3087922: COMMON/BASE/BACKENDS: Code analysis warnings
Commit: ce0cc0ee857740cb0bd1ebd3b4bfa6eefc31aee6
https://github.com/scummvm/scummvm/commit/ce0cc0ee857740cb0bd1ebd3b4bfa6eefc31aee6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-04-17T05:25:06-07:00
Commit Message:
COMMON: Partial fix for #3087922: COMMON/BASE/BACKENDS: Code analysis warnings
Changed paths:
backends/platform/sdl/sdl.cpp
common/macresman.cpp
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index d6e7924..2c0c459 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -378,7 +378,11 @@ void OSystem_SDL::setupIcon() {
unsigned int rgba[256];
unsigned int *icon;
- sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes);
+ if (sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes) != 4) {
+ warning("Wrong format of scummvm_icon[0] (%s)", scummvm_icon[0]);
+
+ return;
+ }
if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) {
warning("Could not load the built-in icon (%d %d %d %d)", w, h, ncols, nbytes);
return;
@@ -393,13 +397,17 @@ void OSystem_SDL::setupIcon() {
unsigned char code;
char color[32];
unsigned int col;
- sscanf(scummvm_icon[1 + i], "%c c %s", &code, color);
+ if (sscanf(scummvm_icon[1 + i], "%c c %s", &code, color) != 2) {
+ warning("Wrong format of scummvm_icon[%d] (%s)", 1 + i, scummvm_icon[1 + i]);
+ }
if (!strcmp(color, "None"))
col = 0x00000000;
else if (!strcmp(color, "black"))
col = 0xFF000000;
else if (color[0] == '#') {
- sscanf(color + 1, "%06x", &col);
+ if (sscanf(color + 1, "%06x", &col) != 1) {
+ warning("Wrong format of color (%s)", color + 1);
+ }
col |= 0xFF000000;
} else {
warning("Could not load the built-in icon (%d %s - %s) ", code, color, scummvm_icon[1 + i]);
diff --git a/common/macresman.cpp b/common/macresman.cpp
index e7d4a30..b06d986 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -623,6 +623,11 @@ void MacResManager::convertCrsrCursor(SeekableReadStream *data, byte **cursor, i
// Pixel data for cursor
int iconDataSize = iconRowBytes * (iconBounds[3] - iconBounds[1]);
byte *iconData = new byte[iconDataSize];
+
+ if (!iconData) {
+ error("Cannot allocate iconData in macresman.cpp");
+ }
+
data->read(iconData, iconDataSize);
// Color table
More information about the Scummvm-git-logs
mailing list