[Scummvm-git-logs] scummvm branch-2-6 -> 7d6a8fe7bbe869db1cf3f9bd08236ac6b40209b7

sev- noreply at scummvm.org
Sun Jun 12 13:10:03 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:
7d6a8fe7bb GRAPHICS: Fix segmentation fault for thumbnail from incomplete fill


Commit: 7d6a8fe7bbe869db1cf3f9bd08236ac6b40209b7
    https://github.com/scummvm/scummvm/commit/7d6a8fe7bbe869db1cf3f9bd08236ac6b40209b7
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2022-06-12T15:09:49+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