[Scummvm-git-logs] scummvm master -> 407187161038403f4d5e1ea35841379edfcef47a

wjp wjp at usecode.org
Wed Oct 26 22:30:43 CEST 2016


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:
4071871610 MADS: Fix two off-by-ones in Fader::insertionSort


Commit: 407187161038403f4d5e1ea35841379edfcef47a
    https://github.com/scummvm/scummvm/commit/407187161038403f4d5e1ea35841379edfcef47a
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2016-10-26T22:30:02+02:00

Commit Message:
MADS: Fix two off-by-ones in Fader::insertionSort

Fixes bug #9631.

Changed paths:
    engines/mads/palette.cpp



diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index 7651fe8..de87029 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -665,15 +665,15 @@ void Fader::insertionSort(int size, byte *id, byte *value) {
 
 				int moveCount = size - arrIndex - 1;
 				if (moveCount > 0) {
-					Common::copy(idP + 1, idP + moveCount + 2, idP);
-					Common::copy(valueP + 1, valueP + moveCount + 2, valueP);
+					Common::copy(idP + 1, idP + moveCount + 1, idP);
+					Common::copy(valueP + 1, valueP + moveCount + 1, valueP);
 				}
 
 				// Scan for insert spot
 				int idx = 0;
 				if (endIndex > 0) {
 					bool breakFlag = false;
-					for (; idx <= endIndex && !breakFlag; ++idx) {
+					for (; idx <= endIndex - 1 && !breakFlag; ++idx) {
 						breakFlag = savedId < id[idx];
 					}
 				}





More information about the Scummvm-git-logs mailing list