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.
This commit is contained in:
antoniou79 2022-06-11 13:28:36 +03:00 committed by Eugene Sandulenko
parent a5068eb9b0
commit 7d6a8fe7bb
No known key found for this signature in database
GPG key ID: 014D387312D34F08

View file

@ -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;