[Scummvm-git-logs] scummvm master -> 9e96c12fc6f67251aa9f29e3de3776dcf7220da0

sev- noreply at scummvm.org
Sun Jun 12 13:09:27 UTC 2022


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:
9e96c12fc6 GRAPHICS: Fix segmentation fault for thumbnail from incomplete fill


Commit: 9e96c12fc6f67251aa9f29e3de3776dcf7220da0
    https://github.com/scummvm/scummvm/commit/9e96c12fc6f67251aa9f29e3de3776dcf7220da0
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-06-12T15:09:25+02:00

Commit Message:
GRAPHICS: Fix segmentation fault for thumbnail from incomplete fill

Common::fill fills up to but not including the address of the last item

Previously the last item of array v was not filled with 0, so if the rest of the code in the scaleLine() method did not update it, it would have a random init value which could cause segmentation fault when using the scale() method.

Changed paths:
    graphics/thumbnail.cpp


diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp
index 2a2cea4e172..126a20d9f36 100644
--- a/graphics/thumbnail.cpp
+++ b/graphics/thumbnail.cpp
@@ -279,7 +279,7 @@ int *scaleLine(int size, int srcSize) {
 	int scale = 100 * size / srcSize;
 	assert(scale > 0);
 	int *v = new int[size];
-	Common::fill(v, &v[size - 1], 0);
+	Common::fill(v, v + size, 0);
 
 	int distCtr = 0;
 	int *destP = v;




More information about the Scummvm-git-logs mailing list